Schedule Subscription Cancellation
POST
/v2/subscriptions/{id}/schedule-cancellationAuthorization
AuthorizationBearer token · headerrequiredMerchant API key scoped to one merchant and environment. Read operations require api:read, normal write operations require api:write, and broadcast mutations also require explicit broadcasts:write.
Path parameters
idstring<uuid>requiredHeader parameters
idempotency-keystringrequiredRequired for write endpoints that create records and need deterministic retry behavior.
min length 1 · max length 255
if-matchstringrequiredStrong entity revision ETag returned by the latest read or write.
matches ^\"[0-9]+\"$
x-request-idstringOptional caller-provided request correlation ID.
min length 1
Request body
application/jsonreasonstringmin length 1 · max length 500
Responses
200OK
subscriptionobjectrequiredShow propertiesHide properties
idstring<uuid>requiredmerchantIdstring<uuid>requiredenvironmentstringrequiredAllowed:
sandboxproductioncustomerIdstring<uuid>requiredplanIdstring<uuid>requiredplanSnapshotobjectrequiredShow propertiesHide properties
planIdstring<uuid>requiredplanVersionIdstring<uuid> | anyrequiredShow propertiesHide properties
Any of:
string<uuid>
string<uuid>any
anyplanVersionNumberinteger | anyrequiredShow propertiesHide properties
Any of:
integer
integerany
anyproductIdstring<uuid>requirednamestringrequiredmin length 1 · max length 160
descriptionstring | anyrequiredShow propertiesHide properties
Any of:
string
stringany
anyamountHalalasintegerrequiredmin -9007199254740991 · max 9007199254740991
currencyanyrequiredintervalstringrequiredAllowed:
monthyearcadenceobjectrequiredShow propertiesHide properties
intervalUnitstringrequiredAllowed:
dayweekmonthyearintervalCountintegerrequiredmin -9007199254740991 · max 9007199254740991
trialDaysintegerrequiredmin 0 · max 365
couponobject | anyrequiredShow propertiesHide properties
Any of:
object
Any of:
object
codestringrequiredmax length 64 · matches ^[A-Z0-9_-]{1,64}$
discountTypeanyrequiredpercentOffBpsintegerrequiredmin 1 · max 10000
amountOffHalalasanyobject
codestringrequiredmax length 64 · matches ^[A-Z0-9_-]{1,64}$
discountTypeanyrequiredamountOffHalalasintegerrequiredmin -9007199254740991 · max 2147483647
percentOffBpsanyany
anybillingAnchorPolicystring | anyrequiredShow propertiesHide properties
Any of:
string
stringany
anybillingAnchorAtstring<date-time> | anyrequiredShow propertiesHide properties
Any of:
string<date-time>
string<date-time>any
anycapturedAtstring<date-time>requiredstatusstringrequiredAllowed:
trialingactiverenewinggrace_periodpast_duecanceledrevisionintegerrequiredmin -9007199254740991 · max 9007199254740991
originalBillingAnchorAtstring<date-time>requiredcurrentPeriodStartedAtstring<date-time>requiredcurrentPeriodEndsAtstring<date-time>requirednextBillingAtstring<date-time> | anyrequiredShow propertiesHide properties
Any of:
string<date-time>
string<date-time>any
anyscheduledCancellationAtstring<date-time> | anyrequiredShow propertiesHide properties
Any of:
string<date-time>
string<date-time>any
anytrialStartedAtstring<date-time> | anyrequiredShow propertiesHide properties
Any of:
string<date-time>
string<date-time>any
anytrialEndsAtstring<date-time> | anyrequiredShow propertiesHide properties
Any of:
string<date-time>
string<date-time>any
anygraceStartedAtstring<date-time> | anyrequiredShow propertiesHide properties
Any of:
string<date-time>
string<date-time>any
anygraceEndsAtstring<date-time> | anyrequiredShow propertiesHide properties
Any of:
string<date-time>
string<date-time>any
anycanceledAtstring<date-time> | anyrequiredShow propertiesHide properties
Any of:
string<date-time>
string<date-time>any
anyendedAtstring<date-time> | anyrequiredShow propertiesHide properties
Any of:
string<date-time>
string<date-time>any
anyscheduledCancellationReasonstring | anyrequiredShow propertiesHide properties
Any of:
string
stringany
anycreatedAtstring<date-time>requiredupdatedAtstring<date-time>required400Standard Cipay error response.
errorobjectrequiredShow propertiesHide properties
codestringrequiredmin length 1
messagestringrequiredmin length 1
requestIdstringrequiredmin length 1
detailsobject401Standard Cipay error response.
errorobjectrequiredShow propertiesHide properties
codestringrequiredmin length 1
messagestringrequiredmin length 1
requestIdstringrequiredmin length 1
detailsobject403Standard Cipay error response.
errorobjectrequiredShow propertiesHide properties
codestringrequiredmin length 1
messagestringrequiredmin length 1
requestIdstringrequiredmin length 1
detailsobject404Standard Cipay error response.
errorobjectrequiredShow propertiesHide properties
codestringrequiredmin length 1
messagestringrequiredmin length 1
requestIdstringrequiredmin length 1
detailsobject409Standard Cipay error response.
errorobjectrequiredShow propertiesHide properties
codestringrequiredmin length 1
messagestringrequiredmin length 1
requestIdstringrequiredmin length 1
detailsobject422Standard Cipay error response.
errorobjectrequiredShow propertiesHide properties
codestringrequiredmin length 1
messagestringrequiredmin length 1
requestIdstringrequiredmin length 1
detailsobject428Standard Cipay error response.
errorobjectrequiredShow propertiesHide properties
codestringrequiredmin length 1
messagestringrequiredmin length 1
requestIdstringrequiredmin length 1
detailsobject429Standard Cipay error response.
errorobjectrequiredShow propertiesHide properties
codestringrequiredmin length 1
messagestringrequiredmin length 1
requestIdstringrequiredmin length 1
detailsobject500Standard Cipay error response.
errorobjectrequiredShow propertiesHide properties
codestringrequiredmin length 1
messagestringrequiredmin length 1
requestIdstringrequiredmin length 1
detailsobjectRequest
curl -X POST "https://api.cipay.net/v2/subscriptions/%3Cuuid%3E/schedule-cancellation" \
-H "Authorization: Bearer YOUR_TOKEN" \
-H "idempotency-key: string" \
-H "if-match: string" \
-H "Content-Type: application/json" \
-d '{
"reason": "string"
}'const response = await fetch("https://api.cipay.net/v2/subscriptions/%3Cuuid%3E/schedule-cancellation", {
method: "POST",
headers: {
"Authorization": "Bearer YOUR_TOKEN",
"idempotency-key": "string",
"if-match": "string",
"Content-Type": "application/json"
},
body: JSON.stringify({
"reason": "string"
})
});Response
{
"subscription": {
"id": "<uuid>",
"merchantId": "<uuid>",
"environment": "sandbox",
"customerId": "<uuid>",
"planId": "<uuid>",
"planSnapshot": {
"planId": "<uuid>",
"planVersionId": "<uuid>",
"planVersionNumber": 0,
"productId": "<uuid>",
"name": "string",
"description": "string",
"amountHalalas": 0,
"currency": "SAR",
"interval": "month",
"cadence": {
"intervalUnit": "day",
"intervalCount": 0
},
"trialDays": 0,
"coupon": {
"code": "string",
"discountType": "percent",
"percentOffBps": 0,
"amountOffHalalas": "string"
},
"billingAnchorPolicy": "keep_anchor",
"billingAnchorAt": "2024-01-01T00:00:00Z",
"capturedAt": "2024-01-01T00:00:00Z"
},
"status": "trialing",
"revision": 0,
"originalBillingAnchorAt": "2024-01-01T00:00:00Z",
"currentPeriodStartedAt": "2024-01-01T00:00:00Z",
"currentPeriodEndsAt": "2024-01-01T00:00:00Z",
"nextBillingAt": "2024-01-01T00:00:00Z",
"scheduledCancellationAt": "2024-01-01T00:00:00Z",
"trialStartedAt": "2024-01-01T00:00:00Z",
"trialEndsAt": "2024-01-01T00:00:00Z",
"graceStartedAt": "2024-01-01T00:00:00Z",
"graceEndsAt": "2024-01-01T00:00:00Z",
"canceledAt": "2024-01-01T00:00:00Z",
"endedAt": "2024-01-01T00:00:00Z",
"scheduledCancellationReason": "string",
"createdAt": "2024-01-01T00:00:00Z",
"updatedAt": "2024-01-01T00:00:00Z"
}
}{
"error": {
"code": "string",
"message": "string",
"requestId": "string",
"details": {}
}
}{
"error": {
"code": "string",
"message": "string",
"requestId": "string",
"details": {}
}
}{
"error": {
"code": "string",
"message": "string",
"requestId": "string",
"details": {}
}
}{
"error": {
"code": "string",
"message": "string",
"requestId": "string",
"details": {}
}
}{
"error": {
"code": "string",
"message": "string",
"requestId": "string",
"details": {}
}
}{
"error": {
"code": "string",
"message": "string",
"requestId": "string",
"details": {}
}
}{
"error": {
"code": "string",
"message": "string",
"requestId": "string",
"details": {}
}
}{
"error": {
"code": "string",
"message": "string",
"requestId": "string",
"details": {}
}
}{
"error": {
"code": "string",
"message": "string",
"requestId": "string",
"details": {}
}
}