Create an order subscription item

How to create an order subscription item via API

To create a new order subscription item, send a POST request to the /api/order_subscription_items endpoint, passing the resource arguments in the request body.

Request

POST https://yourdomain.commercelayer.io/api/order_subscription_items

Arguments

Body ParameterTypeRequired

type

string

Required

attributes.sku_code

string

Optional

attributes.bundle_code

string

Optional

attributes.quantity

integer

Required

attributes.unit_amount_cents

integer

Optional, inherited by item

attributes.reference

string

Optional

attributes.reference_origin

string

Optional

attributes.metadata

object

Optional

relationships.order_subscription

object

Required

relationships.item

object

Required

relationships.sku

object

Optional

relationships.bundle

object

Optional

relationships.adjustment

object

Optional

Example

The following request creates a new order subscription item:

curl -g -X POST \
  'https://yourdomain.commercelayer.io/api/order_subscription_items' \
  -H 'Accept: application/vnd.api+json' \
  -H 'Authorization: Bearer your-access-token' \
  -H 'Content-Type: application/vnd.api+json' \
  -d '{
  "data": {
    "type": "order_subscription_items",
    "attributes": {
      "quantity": 4
    },
    "relationships": {
      "order_subscription": {
        "data": {
          "type": "order_subscriptions",
          "id": "ABCRtyUpBa"
        }
      },
      "item": {
        "data": {
          "type": "adjustments",
          "id": "BCDRtyUpBa"
        }
      }
    }
  }
}'

Last updated