Subscription Cancel by ID API
The following endpoint cancels a single Subscription
/subscriptions/:id/cancel
Path parameters
Field | is required? | Description |
---|---|---|
id | mandatory | string Unique identifier of the Subscription to be cancelled |
Example
curl -u [Base64({Your_Server_Key}:)] \
-X DELETE https://api.durianpay.id/v1/subscriptions/sub_vUoR0w6c6j3912/cancel \
-H "content-type: application/json"'
Response Code : 200
Here is an example of success response
{
"data": {
"id": "sub_vUoR0w6c6j3912",
"status": "expired",
"started_at": "2021-09-30T12:58:38.210535Z",
"cancelled_at": "2021-10-01T12:19:20.851102Z"
}
}
Error Response Code : 401
Here is an example error response for unauthorized access
{
"error": "invalid Authorization header in request",
"error_code": "DPAY_UNAUTHORIZED_ACCESS"
}
Error Response Code : 404
Here is an example error response for resource not found
{
"error": "subscription does not exists",
"error_code": "DPAY_INVALID_REQUEST"
}