Cancel Payment API


The following endpoint cancels a single Payment

/payments/:id/cancel

Path parameters

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

Example

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

Response Code : 200

Here is an example of success response

{
    "data": {
        "id": "pay_ohXLNm2fPw6868",
        "status": "failed",
        "order_id": "ord_Dg0Dz9wwKP1602",
        "created_at": "2020-11-19T22:09:48Z",
        "updated_at": "2020-11-26T20:02:24.561169Z"
    }
}

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