Skip to main content

Cancel Subscription

POST/subscriptions//cancel
Cancels a customer subscription. You can cancel immediately (access revoked right away) or at the end of the current billing period (customer retains access until the period ends).

Authentication

Headers

HeaderValueRequired
AuthorizationBearer YOUR_API_TOKENYes
Content-Typeapplication/jsonYes
Acceptapplication/jsonRecommended

Path Parameters

ParameterTypeRequiredDescription
idintegerYesThe subscription ID

Request Body

ParameterTypeRequiredDescription
effectivestringNoimmediate or end_of_period (default: end_of_period)

Example Request

curl -X POST "https://merchant-api.rmz.gg/shawarma/subscriptions/501/cancel" \
  -H "Authorization: Bearer YOUR_API_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"effective": "end_of_period"}'

Success Response

Returns the full subscription object in the standard SubscriptionResource shape — identical to Get Subscription, List Subscriptions, and Lookup Subscriptions. The fields most relevant to cancellation are shown below — see Get Subscription for the complete field list.
{
  "message": "Subscription canceled successfully",
  "data": {
    "id": 501,
    "status": "active",
    "external_customer_id": "usr_abc123",
    "cancel_at_period_end": true,
    "canceled_at": "2025-06-15T12:00:00.000000Z",
    "current_period_end": "2025-07-01T00:00:00.000000Z"
  },
  "api": "rmz.shawarma",
  "timestamp": 1699999999
}

Behavior Options

BehaviorDescription
end_of_periodThe subscription remains active until current_period_end. No renewal will be attempted. This is the default and recommended option.
immediateThe subscription is canceled and access is revoked immediately. The status changes to canceled.
When using end_of_period, the subscription status stays active and cancel_at_period_end is set to true. The subscription will transition to expired when the period ends.
Immediate cancellation cannot be undone. The customer would need to create a new subscription. Consider using end_of_period to give the customer the full value of their current billing period.

Error Responses

CodeDescription
401Unauthorized — invalid or missing token
404Subscription not found
409Subscription is already canceled or expired
422Validation error — invalid effective value, or subscription already canceled/expired