Subscription

Subscribe

Create a subscription for the current user.

post/subscription

Request body

idstring required

Unique object identifier. The format and length of IDs may change over time.

productVariantIDstring required

ID of the product variant being subscribed to.

priceinteger required

Price of the subscription in cents (USD).

quantityinteger required

Quantity of the subscription.

addressIDstring required

ID of the shipping address used for the subscription.

cardIDstring required

ID of the card used for the subscription.

nextstring

Next shipment and billing date for the subscription.

createdstring required

Date the subscription was created.

Example request

{
  "id": "sub_XXXXXXXXXXXXXXXXXXXXXXXXX",
  "productVariantID": "var_XXXXXXXXXXXXXXXXXXXXXXXXX",
  "price": 2200,
  "quantity": 1,
  "addressID": "shp_XXXXXXXXXXXXXXXXXXXXXXXXX",
  "cardID": "crd_XXXXXXXXXXXXXXXXXXXXXXXXX",
  "schedule": {
    "type": "weekly",
    "interval": 3
  },
  "next": "2025-02-01T19:36:19.000Z",
  "created": "2024-06-29T19:36:19.000Z"
}

Response

Subscription was created successfully.

data'ok' required

Changes

Changed in 10 of the 41 revisions of this API.7134

    • added the new required request property allOf[Subscription]/price

      new-required-request-property

    • added the new required request property allOf[Subscription]/created

      new-required-request-property

  • 1c6726b12e29424See the full diff
    • the response's body type/format changed from / to object/ for status 400

      response-body-type-changed

    • the response's body type/format changed from / to object/ for status 401

      response-body-type-changed

    • the response's body type/format changed from / to object/ for status 429

      response-body-type-changed

    • the response's body type/format changed from / to object/ for status 500

      response-body-type-changed

    • removed ErrorResponse from the response body allOf list for the response status 400

      response-body-all-of-removed

    • removed ErrorResponse from the response body allOf list for the response status 401

      response-body-all-of-removed

    • removed ErrorResponse from the response body allOf list for the response status 429

      response-body-all-of-removed

    • removed ErrorResponse from the response body allOf list for the response status 500

      response-body-all-of-removed

    • added the optional property details to the response with the 400 status

      response-optional-property-added

    • added the optional property details to the response with the 401 status

      response-optional-property-added

    • added the optional property details to the response with the 429 status

      response-optional-property-added

    • added the optional property details to the response with the 500 status

      response-optional-property-added

    • added the optional property param to the response with the 400 status

      response-optional-property-added

    • added the optional property param to the response with the 401 status

      response-optional-property-added

    • added the optional property param to the response with the 429 status

      response-optional-property-added

    • added the optional property param to the response with the 500 status

      response-optional-property-added

    • added the required property code to the response with the 400 status

      response-required-property-added

    • added the required property code to the response with the 401 status

      response-required-property-added

    • added the required property code to the response with the 429 status

      response-required-property-added

    • added the required property code to the response with the 500 status

      response-required-property-added

    • added the required property message to the response with the 400 status

      response-required-property-added

    • added the required property message to the response with the 401 status

      response-required-property-added

    • added the required property message to the response with the 429 status

      response-required-property-added

    • added the required property message to the response with the 500 status

      response-required-property-added

    • added the required property type to the response with the 400 status

      response-required-property-added

    • added the required property type to the response with the 401 status

      response-required-property-added

    • added the required property type to the response with the 429 status

      response-required-property-added

    • added the required property type to the response with the 500 status

      response-required-property-added

    • added the non-success response with the status 400

      response-non-success-status-added

    • added the non-success response with the status 401

      response-non-success-status-added

    • added the non-success response with the status 429

      response-non-success-status-added

    • added the non-success response with the status 500

      response-non-success-status-added

    • removed the request property allOf[Subscription]/frequency

      request-property-removed

  • a43b29f8663911See the full diff
    • removed subschema #1 subschema #2 from the allOf[Subscription]/schedule request property oneOf list

      request-property-one-of-removed

    • added subschema #1: fixed subschema #2: weekly to the allOf[Subscription]/schedule request property oneOf list

      request-property-one-of-added

    • added the new optional request property allOf[Subscription]/schedule

      new-optional-request-property

    • added the new optional request property allOf[Subscription]/next

      new-optional-request-property

    • the data response property const value ok was added for the status 200

      response-property-const-added

    • removed the ok enum value from the data response property for the response status 200

      response-property-enum-value-removed

    • endpoint added

      endpoint-added