Skip to content

Change how several subscriptions collect

POST
/subscriptions/collection-method
Code sample: Shell / cURL
curl --request POST \
--url https://example.com/api/v1/subscriptions/collection-method \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{ "collectionMethod": "CHARGE_AUTOMATICALLY", "orderIds": [ "example" ] }'

Sets collectionMethod on the subscriptions of orderIds in one transaction, each change audited and announced as subscription.updated, exactly as PATCH /orders/{id}/subscription does for one. A canceled subscription is skipped as canceled, and an order outside the workspace or the caller’s order scope, or without a billed subscription, as not_found. Invoices already issued are left as they are. Requires the orders.cancel_subscription permission.

Media typeapplication/json

Changes how several orders’ subscriptions collect, in one transaction. Canceled subscriptions and orders without a billed subscription in the caller’s reach are skipped.

object
collectionMethod
required

How each cycle is collected. CHARGE_AUTOMATICALLY sends the cycle invoice and charges the card on file; SEND_INVOICE only sends the invoice with its payment link, due by the company’s payment terms, and is never charged or retried.

string
Allowed values: CHARGE_AUTOMATICALLY SEND_INVOICE
orderIds
required

The orders whose subscriptions change, at most 100.

Array<string>
>= 1 items <= 100 items

The order ids changed, already collecting that way, and skipped.

Media typeapplication/json
object
data
required
object
changed
required

Order ids whose subscription changed.

Array<string>
skipped
required

Order ids left alone, each with why.

Array<object>
object
orderId
required
string
reason
required

canceled: the subscription is canceled. not_found: no billed subscription on an order in the caller’s reach.

string
Allowed values: canceled not_found
unchanged
required

Order ids whose subscription already collected that way.

Array<string>

Example

{
"data": {
"skipped": [
{
"reason": "canceled"
}
]
}
}

Validation error. Parse failures include field paths and expectations.

Media typeapplication/json

Validation error with safe field paths and expected values; submitted values are never returned.

object
error
required
object
code
required

Stable machine-readable error code.

string
issues
Array<object>
object
expected
required
string
message
required
string
path
required
Array<string | number>
message
required

Human-readable error message.

string
status
required

HTTP status code, mirrored in the body.

integer
>= -9007199254740991 <= 9007199254740991

Example

{
"error": {
"code": "UNAUTHORIZED"
}
}

Unauthorized.

Media typeapplication/json

Standard error envelope.

object
error
required
object
code
required

Stable machine-readable error code.

string
message
required

Human-readable error message.

string
status
required

HTTP status code, mirrored in the body.

integer
>= -9007199254740991 <= 9007199254740991

Example

{
"error": {
"code": "UNAUTHORIZED"
}
}

Forbidden.

Media typeapplication/json

Standard error envelope.

object
error
required
object
code
required

Stable machine-readable error code.

string
message
required

Human-readable error message.

string
status
required

HTTP status code, mirrored in the body.

integer
>= -9007199254740991 <= 9007199254740991

Example

{
"error": {
"code": "UNAUTHORIZED"
}
}

Rate limit exceeded. Wait for Retry-After before retrying.

Media typeapplication/json

Standard error envelope.

object
error
required
object
code
required

Stable machine-readable error code.

string
message
required

Human-readable error message.

string
status
required

HTTP status code, mirrored in the body.

integer
>= -9007199254740991 <= 9007199254740991

Example

{
"error": {
"code": "UNAUTHORIZED"
}
}
RateLimit-Limit
string
/^\d+$/

Maximum requests in the current quota window.

RateLimit-Policy
string

Quota policy in requests and window seconds, for example 60;w=60.

RateLimit-Remaining
string
/^\d+$/

Requests left in this quota window (zero when blocked).

RateLimit-Reset
string
/^\d+$/

Seconds until the current quota window resets, when available from the rate-limit store.

Retry-After
string
/^\d+$/

Seconds until another request may be attempted.