Cancel a subscription

Changed on

Integrator can cancel a subscription using this API endpoint. The subscription Id will be required to cancel a subscription.

Cancellation stops subsequent billing and payment collections but outstanding payments will remain and need to be resolved separately.

Integrators can choose to cancel a subscription in a future date (Do ensure the cancellation date is one day before your actual date the subscriptions needs to end) but the default will be today.

put/billing/subscriptions/{subscriptionId}/cancel

Request

  • Base URL
    https://api-sandbox.ezypay.com/v2
  • URL
    https://api-sandbox.ezypay.com/v2/billing/subscriptions/{subscriptionId}/cancel
  • Auth
    OAuth 2
    Client credentials
    Token URL: https://identity-sandbox.ezypay.com/token

Path parameters

subscriptionIdstring required

Auto-generated unique identifier of the subscription.

Headers

merchantstring required

Merchant ID

Request body

cancellationDatestring

Date when subscription should be cancelled. Supported format is YYYY-MM-DD

Response

200

idstring
customerIdstring
planIdstring
namestring
statusstring
startDatestring
endDateunknown
paymentMethodTokenstring
accountingCodestring
nextBillingDateunknown
nextFutureInvoiceunknown
intervalinteger
intervalUnitstring
totalBillingCyclesinteger
remainingToPayunknown
remainingBillingCyclesunknown
endTargetAmountunknown
endTargetBillingCyclesunknown
cancelledDatestring
failedPaymentHandlingunknown
failedAttemptsCountinteger
metadataunknown
createdOnstring
autoPaymentboolean
setupPaymentsunknown

Example response

{
  "id": "fef9bef0-2081-445d-8a4e-b50a5d9eb2b7",
  "customerId": "4c999653-9473-472e-b478-d56d2a7572a9",
  "planId": "d35f6384-e5af-4eaf-b4c9-d08511a21921",
  "name": "high_st_monthly_plan",
  "status": "CANCELLED",
  "startDate": "2019-04-01",
  "paymentMethodToken": "d178cea3-fdf9-4743-90d8-856af429ab18",
  "accountingCode": "customer_plan",
  "amount": {
    "currency": "NZD",
    "value": 200
  },
  "interval": 1,
  "intervalUnit": "MONTH",
  "totalPaid": {
    "currency": "NZD",
    "value": 400
  },
  "totalBillingCycles": 2,
  "cancelledDate": "2019-07-01",
  "totalPastDue": {
    "currency": "NZD"
  },
  "totalDiscounted": {
    "currency": "NZD"
  },
  "createdOn": "2019-03-31T23:55:11.708",
  "autoPayment": true
}

Changes