The address to attach the subscription to. If you do not have access to the Recharge address_id you can instead pass a Recharge charge_id and Rebuy will infer the address_id from the given charge_id.
charge_id · string
This argument is an alternative for address_id. If you do not have access to the Recharge address_id you can instead pass a Recharge charge_id and Rebuy will infer the address_id from the given charge_id.
next_charge_scheduled_at · string
The value to set for the next_charge_scheduled_at field. Use the keyword today or tomorrow to have Rebuy set the next charge scheduled at date automatically. Example: tomorrow.
shopify_variant_id · string
The Shopify variant ID to create the subscription for.
quantity · string
The quantity of Shopify variant ID to create the subscription for.
order_interval_unit · string
The order interval unit to set for the subscription. Example: Month.
order_interval_frequency · string
The order interval frequency to set for the subscription. Example: 1.
charge_interval_frequency · string
The charge interval frequency to set for the subscription. Example: 1.
charge_now · string
Use this argument and pass yes to charge the users card immediately and create the order.
format · string
Valid values: pretty. Use pretty to make the response easy to read.
// POST https://rebuyengine.com/api/v1/recharge/subscribeconstparams=newURLSearchParams({address_id:"YOUR_VALUE",charge_id:"YOUR_VALUE"});fetch(`https://rebuyengine.com/api/v1/recharge/subscribe?${params}`).then(response=>response.json()).then(data=>console.log(data));
---
title: Subscribe
excerpt: Creates a Recharge subscription according to the given parameters.
api:
file: recharge.json
operationId: subscribe
deprecated: false
hidden: true
metadata:
title: ''
description: ''
robots: index
next:
description: ''
---
## POST /api/v1/recharge/subscribe
!!! note "Use Cases"
Use this endpoint to create subscriptions with a single click.
## Query Parameters
`address_id` · string
: The address to attach the subscription to. If you do not have access to the Recharge address_id you can instead pass a Recharge charge_id and Rebuy will infer the address_id from the given charge_id.
`charge_id` · string
: This argument is an alternative for address_id. If you do not have access to the Recharge address_id you can instead pass a Recharge charge_id and Rebuy will infer the address_id from the given charge_id.
`next_charge_scheduled_at` · string
: The value to set for the next_charge_scheduled_at field. Use the keyword today or tomorrow to have Rebuy set the next charge scheduled at date automatically. Example: tomorrow.
`shopify_variant_id` · string
: The Shopify variant ID to create the subscription for.
`quantity` · string
: The quantity of Shopify variant ID to create the subscription for.
`order_interval_unit` · string
: The order interval unit to set for the subscription. Example: Month.
`order_interval_frequency` · string
: The order interval frequency to set for the subscription. Example: 1.
`charge_interval_frequency` · string
: The charge interval frequency to set for the subscription. Example: 1.
`charge_now` · string
: Use this argument and pass yes to charge the users card immediately and create the order.
`format` · string
: Valid values: pretty. Use pretty to make the response easy to read.
## Code Example
```javascript
// POST https://rebuyengine.com/api/v1/recharge/subscribe
const params = new URLSearchParams({
address_id: "YOUR_VALUE",
charge_id: "YOUR_VALUE"
});
fetch(`https://rebuyengine.com/api/v1/recharge/subscribe?${params}`)
.then(response => response.json())
.then(data => console.log(data));
```
## Response Examples
### 200 - 200
```json
// Need Example Response
```
### 400 - 400
```json
// Need Error Response
```