Next Commerce
Subscriptions

Subscriptions Create

Create a new subscription.

POST
/subscriptions/

Authorization

oauth2 subscriptions:write
AuthorizationBearer <token>

Generate an Access Token through Settings > API Access for single store access or use the Authorization Code flow with your partner App Client ID. Use required permission scopes for API endpoint access. Example Authorization: Bearer 123

In: header

Scope: subscriptions:write

Header Parameters

X-29next-API-Version*string
Default"2023-02-10"
Value in"2023-02-10"

Request Body

attribution?
billing_address?|
billing_same_as_shipping_address?boolean
Defaultfalse
interval*string
  • day - Day
  • week - Week
  • month - Month
  • year - Year
Value in"day" | "week" | "month" | "year"
interval_count*integer
Range1 <= value
lines*array<>
next_renewal_date*string

format: YYYY-MM-DDThh:mm:ss #eg. 2021-12-07T12:04:45

Formatdate-time
payment_details?|
payment_method*string
  • card_token - Card Token
Value in"card_token"
shipping_address?|
shipping_code?|
shipping_price?string
Match^-?\d{0,7}(?:\.\d{0,2})?$
Formatdecimal
use_default_billing_address?boolean
Defaultfalse
use_default_shipping_address?boolean
Defaultfalse
user*

Response Body

application/json

curl -X POST "https://example.29next.store/api/admin/subscriptions/" \
  -H "X-29next-API-Version: 2023-02-10" \
  -H "Authorization: Bearer " \
  -H "Content-Type: application/json" \
  -d '{
    "interval": "day",
    "interval_count": 1,
    "lines": [
      {
        "quantity": 1
      }
    ],
    "next_renewal_date": "2019-08-24T14:15:22Z",
    "payment_method": "card_token",
    "user": {}
  }'
{
  "attribution": {
    "affiliate": "string",
    "agent": {
      "email": "user@example.com",
      "first_name": "string",
      "id": 0,
      "last_name": "string"
    },
    "funnel": "string",
    "gclid": "string",
    "metadata": null,
    "subaffiliate1": "string",
    "subaffiliate2": "string",
    "subaffiliate3": "string",
    "subaffiliate4": "string",
    "subaffiliate5": "string",
    "utm_campaign": "string",
    "utm_content": "string",
    "utm_medium": "string",
    "utm_source": "string",
    "utm_term": "string"
  },
  "billing_address": {
    "country": "string",
    "first_name": "string",
    "id": 0,
    "last_name": "string",
    "line1": "string",
    "line2": "string",
    "line3": "string",
    "line4": "string",
    "phone_number": "string",
    "postcode": "string",
    "state": "string"
  },
  "cancel_reason": "string",
  "cancel_reason_other_message": "string",
  "currency": "string",
  "date_created": "2019-08-24T14:15:22Z",
  "frequency": "string",
  "id": 0,
  "interval": "day",
  "interval_count": 1,
  "is_tax_known": true,
  "is_test": true,
  "lines": [
    {
      "id": 0,
      "metadata": {},
      "price": "string",
      "product": {
        "categories": [
          {
            "id": 0,
            "name": "string",
            "slug": "string"
          }
        ],
        "id": 0,
        "images": [
          {
            "attachment": "string",
            "caption": "string",
            "display_order": 2147483647,
            "file_name": "string",
            "id": 0,
            "src": "http://example.com"
          }
        ],
        "title": "string",
        "upc": "string",
        "url": "http://example.com"
      },
      "quantity": 2147483647,
      "stockrecord": {
        "id": 0,
        "low_stock_threshold": 2147483647,
        "num_allocated": -2147483648,
        "num_in_stock": -2147483648,
        "partner_sku": "string",
        "price": "string",
        "price_currency": "string",
        "price_retail": "string"
      }
    }
  ],
  "next_renewal_date": "2019-08-24T14:15:22Z",
  "num_lines": 0,
  "num_orders": 0,
  "orders": [
    {
      "billing_cycle": 0,
      "order_number": "string"
    }
  ],
  "payment_details": {
    "property1": null,
    "property2": null
  },
  "payment_method": "string",
  "shipping_address": {
    "country": "string",
    "first_name": "string",
    "id": 0,
    "last_name": "string",
    "line1": "string",
    "line2": "string",
    "line3": "string",
    "line4": "string",
    "notes": "string",
    "phone_number": "string",
    "postcode": "string",
    "state": "string"
  },
  "shipping_code": "string",
  "shipping_price": "string",
  "status": "active",
  "total": "string",
  "user": {
    "accepts_marketing": true,
    "email": "user@example.com",
    "first_name": "string",
    "id": 0,
    "ip": "string",
    "language": "string",
    "last_name": "string",
    "phone_number": "string",
    "user_agent": "string"
  }
}