Stop future billing
const url = 'http://localhost:4000/v1/subscriptions/example/cancel';const options = { method: 'POST', headers: { 'idempotency-key': 'example', Authorization: 'Bearer <token>', 'Content-Type': 'application/json' }, body: '{"at_period_end":false}'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request POST \ --url http://localhost:4000/v1/subscriptions/example/cancel \ --header 'Authorization: Bearer <token>' \ --header 'Content-Type: application/json' \ --header 'idempotency-key: example' \ --data '{ "at_period_end": false }'Immediate cancellation voids an invoice that has not started provider checkout. A payment already processing may still settle; pending_payment identifies it. Period-end cancellation lets the current invoice remain payable through grace.
Authorizations
Section titled “Authorizations”Parameters
Section titled “ Parameters ”Path Parameters
Section titled “Path Parameters”Header Parameters
Section titled “Header Parameters”Required retry-safe key; reuse it only for the same operation and request body
Required retry-safe key; reuse it only for the same operation and request body
Request Bodyrequired
Section titled “Request Bodyrequired”object
Responses
Section titled “ Responses ”Subscription with pending payment, if any
object
object
object
object
Current payment attempt; a confirmed failed attempt may be replaced
Stable customer link, payable until grace_ends_at
Invoice becomes overdue after this time but remains payable during grace
A provider payment already in flight may still settle after cancellation
object
Example
{ "object": "subscription", "status": "active", "customer": { "phone": "+221771234567" }, "currency": "XOF", "interval": "day", "latest_invoice": { "object": "invoice", "currency": "XOF", "status": "open" }, "pending_payment": { "status": "requires_payment_method" }}Validation error
object
object
Examplegenerated
{ "error": { "code": "example", "message": "example", "details": "example" }}Authentication error
object
object
Examplegenerated
{ "error": { "code": "example", "message": "example", "details": "example" }}Forbidden
object
object
Examplegenerated
{ "error": { "code": "example", "message": "example", "details": "example" }}Not found
object
object
Examplegenerated
{ "error": { "code": "example", "message": "example", "details": "example" }}Idempotency conflict or invalid state
object
object
Examplegenerated
{ "error": { "code": "example", "message": "example", "details": "example" }}Rate limited; see Retry-After response header
object
object
Examplegenerated
{ "error": { "code": "example", "message": "example", "details": "example" }}