Skip to main content
Version: v2alpha1

Cancel subscriptions using the API

Steps

1. Get subscription next billing cycles

List the next billing cycles for the subscription by calling GET /subscriptions/{subscription_id}/billing_cycles. The list of the next billing cycle can help you determine which is the ends_at date to use in the cancel subscription step.

Check the pagination in the getpaid API to understand how list of resources work.

Response

200 OK
{
"cursor": "Q3VyaW9zaXR5IGtpbGwgdGhlIGNhdA==",
"data": [
{
"starts_at": "2025-03-01",
"ends_at": "2025-03-31"
},
{
"starts_at": "2025-04-01",
"ends_at": "2025-04-30"
},
[...]
]
}

2. Cancel subscription

Once you have determined which is the last billing cycle to invoice, use the billing cycle ends_at date to cancel the subscription by calling POST /subscriptions/{subscription_id}/cancel.

The subscription will issue invoices until the last billing cycle selected.

Request

POST /subscriptions/{subscription_id}/cancel
{
"billing_cycle": {
"ends_at": "2025-04-30"
}
}