Cancel Subscription
POST
Request Body Parameters
application/jsonCommon Request Parameters
bizContent
merchantSubscriptionIdString(64)ConditionalMerchant-defined unique subscription plan ID. At least one of this field or subscriptionId is required.subscriptionIdString(64)ConditionalPingPong subscription ID. At least one of this field or merchantSubscriptionId is required.requestIdString(64)RequiredMerchant request ID.cancelAtPeriodEndBooleanOptionalIftrueis passed, the subscription will not be canceled immediately and will instead be canceled automatically at the end of the current billing cycle. Before the period ends, the subscription remains active in its current state and the merchant should continue providing service. Iffalseis passed, the cancellation is handled immediately according to this request or other change parameters. Default isfalse.prorationModeString(64)OptionalProration mode for immediate cancellation. Only applicable when cancelAtPeriodEnd isfalse. Defaults toNONEif not provided, meaning no automatic refund is calculated based on the remaining period. Valid values include:PRORATED: considers the residual value of the unused service time and calculates any extra charge or refund based on the remaining time.NONE: does not consider the residual value of the unused service time.CUSTOM: the merchant defines the refund amount generated by this cancellation instead of letting the system calculate the refund amount based on the remaining cycle automatically.
Note: when cancelAtPeriodEnd istrue(period-end cancellation), this field together with customRefundAmount, customCurrency, and refundNotifyUrl must all be omitted — even explicitly passingNONEis rejected with102000 refund fields only support immediate cancellation. For period-end cancellation, omit the prorationMode field entirely.customRefundAmountString(12)ConditionalRequired when prorationMode isCUSTOM. Indicates the merchant-defined refund amount for this cancellation. This amount is used only for the refund handling associated with this cancellation request.customCurrencyString(3)ConditionalRequired when prorationMode isCUSTOM. Indicates the currency corresponding to the merchant-defined refund amount. Use a 3-letter ISO 4217 currency code.refundNotifyUrlString(255)OptionalIf this cancellation generates a refund, this URL is used to receive the asynchronous notification for that refund result. It applies only to this cancellation request.
URL recommendation: use a complete URL with a publicly reachable domain name. Standard web ports are recommended (HTTPS defaults to 443 and HTTP defaults to 80). Ensure the URL can reliably receive PingPongCheckout asynchronous notifications.
Request Body Example
{
"clientId": "2024061100000000001",
"accId": "20240611000000000010001",
"signType": "SHA256",
"sign": "SIGN_VALUE",
"version": "1.0",
"bizContent": {
"merchantSubscriptionId": "SUB_M_202606110001",
"subscriptionId": "SUB-1234567890abcdef",
"requestId": "REQ_SUB_CANCEL_001",
"cancelAtPeriodEnd": false,
"prorationMode": "CUSTOM",
"customRefundAmount": "0.33",
"customCurrency": "USD",
"refundNotifyUrl": "https://merchant.example.com/refund/notify"
}
}Responses Body Parameters
application/jsonCommon Response Parameters
bizContent
periodObjectOptionalSubscription billing cycle.countIntegerRequiredNumber of units in one formal billing cycle. Must be at least1. For example, unit =MONTHand count =1means monthly billing. This is not the total number of billing cycles.unitStringRequiredSubscription period unit type. Valid values include:YEAR: the subscription cycle is measured in years.MONTH: the subscription cycle is measured in months.WEEK: the subscription cycle is measured in weeks.DAY: the subscription cycle is measured in days.
flatPriceObjectOptionalRecurring amount and currency for each formal billing cycle.amountString(12)RequiredRecurring billing amount for each cycle.currencyString(3)RequiredRecurring billing currency in ISO 4217 3-letter format.
trialObjectOptionalTrial settings.startAtString(10)OptionalTrial start time as a 10-digit second-level timestamp string.endAtString(10)ConditionalTrial end time as a 10-digit second-level timestamp string.periodDaysIntegerConditionalTrial duration in days.
autoRecoveryObjectOptionalAutomatic retry settings.enabledBooleanOptionalWhether automatic retry is enabled. Automatic retry is enabled by default.true: retry enabledfalse: retry disabled
merchantSubscriptionIdString(64)RequiredMerchant-defined unique subscription plan ID.subscriptionIdString(64)RequiredPingPong subscription ID.requestIdString(64)RequiredMerchant request ID.statusString(32)RequiredSubscription plan status. Valid values include:PENDING: the subscription has been created but is not yet active.IN_TRIAL: the subscription is in the trial period and service is available, but the first formal charge has not completed yet.ACTIVE: the subscription is currently active and the user is entitled to the service.PAST_DUE: the subscription reached its charge time but the current charge failed, entering the dunning or retry stage.CANCELLED: the subscription has ended and will not renew automatically.
cancelReasonString(64)OptionalReturned when the subscription status isCANCELLED, indicating why the subscription ended.user_requested: canceled by the usermerchant_requested: canceled by the merchantpayment_retry_exhausted: retry attempts exhaustedplan_ended: plan naturally ended
notifyUrlString(255)OptionalSubscription notification URL.startAtString(13)OptionalSubscription start time as a 13-digit millisecond timestamp string.endAtString(13)OptionalSubscription end time as a 13-digit millisecond timestamp string.totalPeriodCountIntegerOptionalTotal number of formal billing cycles in the subscription plan. Must be at least1and excludes the trial period. If omitted, the number of formal billing cycles is unlimited.cancelAtPeriodEndBooleanOptionalWhether the subscription plan will be canceled at the end of the current billing cycle.truemeans it will be canceled at period end.cancelAtString(13)OptionalActual cancellation time as a 13-digit millisecond timestamp string.resultCodeStringRequiredBusiness result code.resultMessageStringRequiredBusiness result message.
Request Body Example
{
"clientId": "2025050971820281024",
"accId": "2025050971820281024001",
"signType": "MD5",
"sign": "SIGN_VALUE",
"version": "1.0",
"bizContent": {
"merchantSubscriptionId": "SUB_MER_001",
"subscriptionId": "SUB-1234567890abcdef",
"requestId": "REQ_SUB_CANCEL_001",
"status": "CANCELLED",
"cancelReason": "merchant_requested",
"notifyUrl": "https://merchant.example.com/notify/subscription",
"startAt": "1792152473588",
"endAt": "1823688473588",
"flatPrice": {
"amount": "10.00",
"currency": "USD"
},
"period": {
"count": 1,
"unit": "MONTH"
},
"totalPeriodCount": 12,
"trial": {
"startAt": "1785152760",
"endAt": "1785757560",
"periodDays": 7
},
"autoRecovery": {
"enabled": true
},
"cancelAtPeriodEnd": false,
"cancelAt": "1792152491606",
"resultCode": "000000",
"resultMessage": "SUCCESS"
},
"code": "000000",
"description": "SUCCESS"
}