Cancel Subscription
After the subscription plan is activated, merchants can apply for cancellation based on user needs. PayerMax provides two cancellation methods: Cancel at Period End and Cancel Immediately.
1. Comparison of the Two Cancellation Methods
| Cancellation Method | Effect | Reversible | Applicable Scenarios |
|---|---|---|---|
| Cancel at Period End | Users can continue to use the service within the current billing period. The subscription automatically terminates at the end of the billing period and will not renew. | Reversible (before expiration) | User applies for cancellation but needs to finish the paid period; user changes their mind before the delayed cancellation takes effect and continues the subscription. |
| Cancel Immediately | The subscription terminates immediately; services are no longer provided, and no further deductions are made. | Not Reversible | Scenarios requiring immediate service termination, such as violations, fraud, or strong user requests. |
2. Cancel Immediately
Cancel Immediately is suitable for scenarios requiring immediate service and deduction termination (e.g., violation handling, fraud risk control). It is not suitable for regular cancellation scenarios where the user is expected to finish the paid period; for regular scenarios, please prioritize "Cancel at Period End".
Call the subscription cancellation API (subscriptionCancel) to immediately terminate the subscription plan. Field descriptions can refer to the official subscriptionCancel API documentation.
After requesting this API, the subscription plan will be cancelled immediately and irreversibly! Please fully confirm with the user before calling, or add a secondary confirmation step in your system to avoid irreversible cancellation due to misoperation.
3. Cancel at Period End / Revoke Cancellation
Both use the same API (subscriptionUpdate), distinguished by the cancelAtPeriodEnd field.
Test environment:
https://pay-gate-uat.payermax.com/aggregate-pay/api/gateway/subscriptionUpdateProduction environment:
https://pay-gate.payermax.com/aggregate-pay/api/gateway/subscriptionUpdate
3.1 Request Example
API request parameter description:
cancelAtPeriodEnd: When true, it means cancel at period end; when false, it means revoke cancel at period end.
// Cancel at Period End Request Example
{
"version": "1.5",
"keyVersion": "1",
"requestTime": "2025-02-26T05:00:00+00:00",
"appId": "<your-app-id>",
"merchantNo": "<your-merchant-no>",
"data": {
"subscriptionNo": "SUB20250417120949065211234",
"subscriptionRequestId": "requestId_test001",
"cancelAtPeriodEnd": true, // true: cancel at period end
"cancellationReason": "User actively applied for cancellation" // Cancellation reason
}
}
// Revoke Cancel at Period End Request Example
{
"version": "1.5",
"keyVersion": "1",
"requestTime": "2025-02-26T05:00:00+00:00",
"appId": "<your-app-id>",
"merchantNo": "<your-merchant-no>",
"data": {
"subscriptionNo": "SUB20250417120949065211234",
"subscriptionRequestId": "requestId_test001",
"cancelAtPeriodEnd": false // false: revoke cancel at period end
}
}3.2 Special Notes
When operating Cancel at Period End, the subscription plan must be in the active (
ACTIVE) status, with no ongoing change requests, no deductions in progress, and no pending delayed cancellation tasks;When operating Revoke Cancel at Period End, there must be a pending delayed cancellation task, and the task execution time must not have been reached.
3.3 Response Example
// Cancel at Period End Response Example
{
"code": "APPLY_SUCCESS",
"msg": "Success.",
"data": {
"subscriptionRequestId": "req_001",
"merchantNo": "P0014894534684",
"subscriptionPlan": {
"subscriptionNo": "SUB20250417120949065211234",
"subscriptionStatus": "ACTIVE",
"cancelExecuteTime": "2026-06-10T03:33:39+0000" // Estimated execution time of cancellation (UTC)
}
}
}
// Revoke Cancel at Period End Response Example
{
"code": "APPLY_SUCCESS",
"msg": "Success.",
"data": {
"subscriptionRequestId": "req_001",
"merchantNo": "P0014894534684",
"subscriptionPlan": {
"subscriptionNo": "SUB20250417120949065211234",
"subscriptionStatus": "ACTIVE"
}
}
}After successfully submitting "Cancel at Period End",
subscriptionStatusremainsACTIVE, and the subscription is not terminated immediately; the actual termination will automatically occur whencancelExecuteTimeis reached, at which point the status becomesCANCEL. It is recommended to confirm the final result through the query API or status notification.
4. Query Subscription Plan (including cancellation information)
The query API adds delayed cancellation fields on top of the original return fields, which can be used to determine whether the subscription is in the waiting state of "Cancel at Period End".
Test environment:
https://pay-gate-uat.payermax.com/aggregate-pay/api/gateway/subscriptionQueryProduction environment:
https://pay-gate.payermax.com/aggregate-pay/api/gateway/subscriptionQuery
4.2 Request Example
{
"version": "1.5",
"keyVersion": "1",
"requestTime": "2025-02-26T05:00:00+00:00",
"appId": "<your-app-id>",
"merchantNo": "<your-merchant-no>",
"data": {
"subscriptionNo": "SUB20250417120949065211234"
}
}4.2 Response Example
{
"code": "APPLY_SUCCESS",
"msg": "Success.",
"data": {
"merchantNo": "P0014894534684",
"subscriptionPlan": {
"subscriptionNo": "SUB20250417121234565211234",
"subscriptionStatus": "ACTIVE",
"cancelExecuteTime": "2026-08-04T03:16:30+0000",
"cancellationReason": "Cancellation reason example"
},
"subscriptionPaymentDetails": [
{
"cardOrg": "VISA",
"cardInfo": {
"cardOrg": "VISA",
"country": "US",
"cardHolderName": "Debra********",
"cardExpirationMonth": "08",
"cardType": "CREDIT",
"cardExpirationYear": "29",
"cardNumber": "446123****1234",
"cardBinNo": "446540"
},
"payAmount": {
"amount": 1.99,
"currency": "USD"
},
"lastPaymentInfo": {
"payTime": "2026-07-05T03:18:25+0000",
"tradeToken": "T2026070503012345574321"
},
"periodStartTime": "2026-07-05T03:16:31+0000",
"periodEndTime": "2026-08-04T03:16:30+0000",
"subscriptionIndex": 0,
"paymentMethodType": "CARD",
"paymentStatus": "SUCCESS"
}
]
}
}