API Docs
Subscriptions
API ReferenceSubscriptionsCancel

Cancel Subscription

Cancel an existing subscription.

POST /subscriptions/{subscription_id}/cancel

Path Parameters

ParameterTypeRequiredDescription
subscription_idstringYesThe unique identifier for the subscription.

Headers

HeaderTypeRequiredDescription
api-keystringYesYour secret API key.
X-Profile-IdstringYesProfile ID for authentication.

Body Parameters

ParameterTypeRequiredDescription
cancel_optionstringNoWhen to cancel: immediately, end_of_term, specific_date.
cancel_atstringNoSpecific date to cancel the subscription (ISO format).
unbilled_charges_optionstringNoHow to handle unbilled charges: invoice or delete.
credit_option_for_current_term_chargesstringNoCredit handling: none, prorate, full.
account_receivables_handlingstringNoReceivables handling: no_action, schedule_payment_collection, write_off.
refundable_credits_handlingstringNoRefundable credits: no_action, schedule_refund.
cancel_reason_codestringNoReason for cancelling the subscription.

Request Example

curl -X POST 'https://api.sandbox.paychtec.com/subscriptions/sub_123/cancel' \  -H "Content-Type: application/json" \  -H "api-key: snd_YOUR_API_KEY" \  -H "X-Profile-Id: prof_12345" \  -d '{  "cancel_option": "immediately",  "credit_option_for_current_term_charges": "prorate",  "refundable_credits_handling": "schedule_refund",  "unbilled_charges_option": "invoice"}'