Cancel, resume or refund the subscription
cancel ends the subscription at the period end; resume undoes a pending cancel; refund refunds the last paid invoice and ends the subscription now. extend is always refused with next: upgrade_plan, because pay as you go bills only what was sent. A project admin acts here; an API key gets 401.
Requires the billing:write scope — Start a checkout, change spending limits, open the billing portal, cancel or refund.
BetterAuth session cookie. Used by the dashboard / browser clients. When present, the active project is taken from the x-project-id header.
In: cookie
Request Body
application/json
TypeScript Definitions
Use the request body type in TypeScript.
Response Body
application/json
application/problem+json
application/problem+json
application/problem+json
application/problem+json
application/problem+json
curl -X POST "https://example.com/api/v1/billing/subscription" \ -H "Content-Type: application/json" \ -d '{ "action": "cancel" }'{
"subscription": {
"id": "string",
"status": "string",
"cancelAtPeriodEnd": true,
"currentPeriodEnd": 0
},
"refund": {
"id": "string",
"status": "string",
"amount": 0,
"currency": "string"
},
"status": "action_required",
"url": "http://example.com",
"expires_in": 0,
"what": "string",
"instruction": "string"
}{
"type": "http://example.com",
"title": "string",
"status": 0,
"detail": "string",
"instance": "string",
"code": "string",
"request_id": "string",
"errors": [
{
"pointer": "string",
"code": "string",
"message": "string"
}
],
"next": {
"tool": "string",
"args": {
"property1": null,
"property2": null
}
}
}{
"type": "http://example.com",
"title": "string",
"status": 0,
"detail": "string",
"instance": "string",
"code": "string",
"request_id": "string",
"errors": [
{
"pointer": "string",
"code": "string",
"message": "string"
}
],
"next": {
"tool": "string",
"args": {
"property1": null,
"property2": null
}
}
}{
"type": "http://example.com",
"title": "string",
"status": 0,
"detail": "string",
"instance": "string",
"code": "string",
"request_id": "string",
"errors": [
{
"pointer": "string",
"code": "string",
"message": "string"
}
],
"next": {
"tool": "string",
"args": {
"property1": null,
"property2": null
}
}
}{
"type": "http://example.com",
"title": "string",
"status": 0,
"detail": "string",
"instance": "string",
"code": "string",
"request_id": "string",
"errors": [
{
"pointer": "string",
"code": "string",
"message": "string"
}
],
"next": {
"tool": "string",
"args": {
"property1": null,
"property2": null
}
}
}{
"type": "http://example.com",
"title": "string",
"status": 0,
"detail": "string",
"instance": "string",
"code": "string",
"request_id": "string",
"errors": [
{
"pointer": "string",
"code": "string",
"message": "string"
}
],
"next": {
"tool": "string",
"args": {
"property1": null,
"property2": null
}
}
}