Cancel a Subscription

Cancel a subscription with Recurring Billing.

This guide shows you how to use the Recurring Billing API resource to cancel a subscription. Note that you can only cancel active, suspended, or paused subscriptions. A canceled subscription cannot be resumed. See Cancel a Subscription in API Reference for field definitions.


  1. See Create a Sandbox Account to sign up and log in to the Maast Manager portal.

  2. Follow the steps in Get Your API Credentials to save a sandbox ID and API key.

  3. See Authentication to format the credentials and generate your API token. (Alternatively, use the credentials as-is to test this endpoint with our 'Try It!' feature.)

  4. Follow the steps in the Add a Subscription guide to create a subscription. Save the subscription_id value from the request response.

  5. Find the customer_id value of the customer whose subscription you wish to cancel. This was returned when adding the customer to Customer Vault (via 'Add a Subscription' or a Customer Vault request).


  1. Write a POST request. For the request endpoint, insert the subscription_id value between /subscription/ and /cancel. The resulting endpoint is /platform/subscription/subscription_id/cancel, where the value replaces subscription_id.

See the url in the sample code below:

curl --request POST \
     --url \
     --header 'accept: application/json' \
     --header 'authorization: Basic OjllZGVjMjFhMzFjMHh5ejc4OWUzMGEzNDE2YWJjMTIz' \
     --header 'content-Type: application/json' \
     --data '
     "customer_id": "JOHNDOE",
     "merchant_id": 210000000289
  1. Insert the the appropriate customer ID in the customer_id field in the body of the request.

  2. If you are sending this request on behalf of another merchant, include the merchant_id field with their merchant ID in the body of the request.

Your full request should resemble the sample code above.


Once you have written and sent your POST request, you will receive a response like this from the Maast server:

  "code": 0,
  "data": {
    "message": "Subscription cancelled"
  "message": "Success"

Check the code value in the request response: 0 confirms a successful transaction. Note:

  • If the value is something other than 0, check Platform API Response Codes in Reference.
  • 0 means that you have canceled the subscription. A canceled subscription cannot be resumed.

See Cancel a Subscription in API Reference for response field definitions.

Test and Go Live

See our Test and Go Live guide to test your API integration and to start transacting with an active production account.