Payment Fetch by ID API


The following endpoint retrieves the details of a single Payment

/payments/:id

Path Parameters

Fieldis required?Description
idmandatoryinteger Unique identifier of the Payment to be retrieved

Query parameters

Fieldis required?Description
expandoptionalinteger Used to retrieve additional information about the Payment. Supported values are: customer, order. Example: /payments/pay_A1B1C1D1234?expand=customer&expand=order

Example

curl -X GET \
  https://api.durianpay.id/v1/payments/pay_76n67eK9Fq4137 \
  -H 'authorization: [Base64({Your_Server_Key}:)]' \
  -H 'content-type: application/json' \

Response Code : 200

Here is an example of success response

{
    "id": "pay_A31sd3AwAgItmmXdp",
    "amount": "20000",
    "currency": "IDR",
    "status": "completed",
    "order_id": "ord_B14sdfwAdmmSDF24a",
    "payment_ref_id": "txn2314",
    "created_at": 1582628071,
    "metadata": []
}

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 payment",
    "error_code": "DPAY_INTERNAL_ERROR"
}