Update an order subscription

How to update an existing order subscription via API

To update an existing order subscription, send a PATCH request to the /api/order_subscriptions/:id endpoint, where id is the ID of the resource that you want to update.

Here below the list of all the possible arguments that you can pass with the request body.

Request

PATCH https://yourdomain.commercelayer.io/api/order_subscriptions/:id

Arguments

Body ParameterTypeRequired

type

string

Required

id

string

Required

attributes.frequency

string

Optional

attributes.activate_by_source_order

boolean

Optional

attributes.place_target_order

boolean

Optional

attributes.renewal_alert_period

integer

Optional

attributes.expires_at

datetime

Optional

attributes.next_run_at

datetime

Optional

attributes._activate

boolean

Optional

attributes._deactivate

boolean

Optional

attributes._cancel

boolean

Optional

attributes.reference

string

Optional

attributes.reference_origin

string

Optional

attributes.metadata

object

Optional

relationships.customer_payment_source

object

Optional

Example

The following request updates the order subscription identified by the ID "xYZkjABcde":

curl -g -X PATCH \
  'https://yourdomain.commercelayer.io/api/order_subscriptions/xYZkjABcde' \
  -H 'Accept: application/vnd.api+json' \
  -H 'Authorization: Bearer your-access-token' \
  -H 'Content-Type: application/vnd.api+json' \
  -d '{
  "data": {
    "type": "order_subscriptions",
    "id": "xYZkjABcde",
    "attributes": {
      "expires_at": "2018-01-02T12:00:00.000Z"
    },
    "relationships": {
      "customer_payment_source": {
        "data": {
          "type": "customer_payment_sources",
          "id": "ABCRtyUpBa"
        }
      }
    }
  }
}'

Last updated