API ReferenceBilling
Cancel, resume or refund the subscription
POST
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.
cookie
better-auth.session_token<token>BetterAuth session cookie. Used by the dashboard / browser clients. When present, the active project is taken from the x-project-id header.
application/json- body
action*stringValue in
"cancel""resume""refund""extend"OK
application/json- response
subscription?refund?Present for refund.
status?"action_required"Present instead of subscription when a store sold the subscription: url opens that store's page.
Value in
"action_required"url?stringFormat
uriexpires_in?integerwhat?stringinstruction?stringcurl -X POST 'https://api.sendly.now/api/v1/billing/subscription' \ -H 'Content-Type: application/json' \ -d '{ "action": "cancel"}'Example Response
{ "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"}