Cancelling subscriptions for recurring payments
At any time, you have the option to cancel a subscription to recurring payments, either at your own discretion or at the customer’s request.
To do so, send a PUT
request to the /api/v1/recurring/:recurringId/cancel
endpoint, where the value of the recurringId
parameter should be the unique ID associated with the corresponding recurring payment subscription.
Request example:
curl --location \
--request PUT 'https://api.tranzzo.com/api/v1/recurring/UGqZLkh3VoxdG2llFGz84/cancel' \
--header 'X-API-Auth: CPAY-HMAC f3572ccc-7794-480a-b72e-83bee915a1b0:3872075252afc108bc5c7668349193c74718332a' \
--header 'X-API-Key: AIzaSyBi23UpVOCqAjMRSwnWgi1HNXDtco478m8'
Response example:
{
"recurring_payment": {
"pos_id": "2a810802-d3ac-4aad-b4c7-74c54cba628e",
"company_id": "f636d31e-2711-41f7-8d4f-535e897e43f1",
"order_id": "P4rTCGHOBySWc9J",
"amount": 7,
"currency": "UAH",
"cc_token": "ZTM4ZGRhZDc2NWVhNGNiYmFmYjQxOWRmMjU2YzM1YjU6RjdHZHZ2RFhqUkZ0ZFZjT0hY",
"description": "Test recurring",
"payway": "cc",
"server_url": "https://webhook.site/36eb903e-e8fc-4163-8efc-f245cc7a7f7f"
},
"recurring_config": {
"interval_unit": "day",
"interval_count": 1,
"retry_attempts": 5,
"retry_interval_hours": 1,
"start_date": "2023-09-13",
"expiry_date": "2023-09-15",
"time": "10:10:00"
},
"recurring_status": "canceled",
"metadata": {
"id": "SOS6EUthvMXo137Wf7h5F",
"created_at": "2023-09-13T20:53:17.736",
"updated_at": "2023-09-14T10:31:14.012"
}
}
After the request is successfully processed, the subscription to recurring payments will be canceled, and no further debits will be made from the customer for the corresponding order.
To test the subscription cancelling process:
- Create a subscription for recurring payments.
- Send the request to cancel the subscription.
- Handle received errors.
Going live:
Upon activation of the live project by our Compliance Team, use its authentication data instead of the one of the test project.