Subscription Fetch by ID API
The following endpoint retrieves the details of a single Subscription
/subscriptions/:id
Path parameters
Field | is required? | Description |
---|---|---|
id | mandatory | string Unique identifier of the Subscription to be retrieved |
Query parameters
Field | is required? | Description |
---|---|---|
expand | optional | string Used to retrieve additional information about the Subscription. Supported values are: customer ,order . Example: /subscriptions/sub_jrmFNNJu5F99?expand=order&expand=customer |
Example
curl -u [Base64({Your_Server_Key}:)] \
-X DELETE https://api.durianpay.id/v1/subscriptions/sub_jrmFNNJu5F9959 \
-H "content-type: application/json"'
Response Code : 200
Here is an example of success response
{
"data": {
"id": "sub_vUoR0w6c6j3912",
"plan": {
"id": "sub_plan_WdFvTrtP5Z6646",
"name": "Plan/Package Name",
"billing_period": "daily",
"billing_period_count": 1,
"grace_period": "annually",
"grace_period_count": 24,
"price": "20000.00",
"subscription_ref_id": "merchant_sub_ref_id"
},
"charge_type": "manual",
"status": "expired",
"started_at": "2021-09-30T12:58:38.210535Z",
"next_due_date": "2021-09-29T12:58:38.210535Z",
"billing_cycle_count": 10,
"amount": "40000.00",
"active_order_id": "",
"link": "https://links.durianpay.id/subscription-link/n7Hmh8"
}
}
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": "error subscription order not found",
"error_code": "DPAY_SUBSCRIPTION_NOT_FOUND"
}
Error Response Code : 500
Here is an example error response for internal server error
{
"error": "error getting order",
"error_code": "DPAY_INTERNAL_ERROR"
}