Refund an already processed payment.
Starts a new Refund for given Order, Payment and a Merchant.
POST /ps/api/public/v1/merchants/{merchant_key}/orders/{order_key}/payments/{payment_id}/refunds
Identifiers
Name | Type | Description |
---|---|---|
merchant_key | MerchantKey | The key of the merchant. |
order_key | OrderKey | The key of the order. |
payment_id | PaymentIdentifier | The payment identifier. |
Parameters
Not applicable.
Request
Field | Type | M | Description |
---|---|---|---|
refund_reference | String(1, 35) | O | The refund reference from the merchant. |
description | String(1, 255) | O | The description for the refund. |
amount | Amount | O | The refund amount in minor units, e.g. in cents. |
currency | Currency | C | The refund amount currency. Must be present if the refund amount is given. |
refund_required_date | Date | O | The date the refund must be captured. |
Response
Not applicable.
HTTP Status
Status | Meaning |
---|---|
201 (Created) | The refund is successfully created. |
400 (Bad Request) | The request was not valid. Examples: Currency is not provided when amount is provided OR payment is not yet captured, or (partial) refund not allowed on the route. |
403 (Forbidden) | The merchant key is not allowed. |
404 (Not Found) | The transaction key or the payment id not found. |
Refund payment example
> curl \
-X POST \
--header 'Content-Type: application/json' \
--header 'Authorization: Basic RG9jZGF0YVBGOkJXazJhZkpV' \
https://testsecure.docdatapayments.com/ps/api/public/v1/merchants/4ef08825-993a-424d-a769-3ee97116a1b6/orders/3B88E0EF13E37D6A56AE949AD9E56961/payments/pid2163179782t/refunds \
-d '{
"refund_reference": "refund-1",
"description" : "Refund a Payment",
"amount" : 1000,
"currency" : "EUR",
"refund_required_date" : "2020-08-31"
}'
< Http 201 Created
> curl \
-X POST \
--header 'Content-Type: application/json' \
--header 'Authorization: Basic RG9jZGF0YVBGOkJXazJhZkpV' \
https://testsecure.docdatapayments.com/ps/api/public/v1/merchants/4ef08825-993a-424d-a769-3ee97116a1b6/orders/3B88E0EF13E37D6A56AE949AD9E56961/payments/pid2163179782t/refunds \
-d '{
"refund_reference": "refund-1",
"description" : "Refund a Payment"
}'
< Http 201 Created