Skip to Content
SendlySendly
API ReferenceBilling

Cancel, resume or refund the subscription

POST
/api/v1/billing/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.

cookiebetter-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
  1. body
action*string
Value in"cancel""resume""refund""extend"

Response Body

OK

application/json
  1. 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?string
Formaturi
expires_in?integer
what?string
instruction?string
Example Request
curl -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"}