Subscriptions Fetch API


The following endpoint retrieves the details of all Subscriptions created

/subscriptions

Query parameters

Following are the parameters to be sent in the request body:

Fieldis required?Description
fromoptionalinteger Timestamp (in Unix format) from when the Subscriptions should be fetched
tooptionalinteger Timestamp (in Unix format) up till when Subscriptions are to be fetched
skipoptionalinteger The number of subscriptions to be skipped. The default value is 0. This can be used for pagination, in combination with count
limitoptionalinteger Number of subscriptions to be fetched. Default value is 25. This can be used for pagination, in combination with the skip parameter
searchoptionalstring find subscriptions matching text with Durianpay Subscription ID.

Example

curl -u [Base64({Your_Server_Key}:)] \
-X GET https://api.durianpay.id/v1/subscriptions?limit=50&skip=10 \
-H "content-type: application/json"'

Response Code : 200

Here is an example of success response

{
    "data": {
        "subscription": [
            {
                "id": "sub_7HAtpFqE7g0944",
                "status": "wait_for_payment",
                "charge_type": "manual",
                "name": "Plan/Package Name",
                "started_at": "2021-10-01T12:58:38.210535Z",
                "billing_period": "monthly",
                "billing_period_count": 1,
                "customer": {
                    "id": "cus_g0tw6z7sDF4506",
                    "email": "jude.casper@durianpay.i",
                    "mobile": "+628978678511",
                    "given_name": "Jude",
                    "middle_name": "",
                    "sur_name": "Casper"
                }
            }
        ],
        "count": 1
    }
}

Error Response Code : 400

Here is an example error response for invalid request

{
    "error": "invalid skip and limit parameter",
    "error_code": "DPAY_INVALID_REQUEST"
}

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 : 500

Here is an example error response for internal server error

{
    "error": "error getting subscriptions",
    "error_code": "DPAY_INTERNAL_ERROR"
}