Refunds
A refund returns all or part of a payment to the payer. You request it; the result arrives later as a webhook event.
Read Refunds for the model and the lifecycle. For a walkthrough, read Refund a payment.
The refund object#
A return of all or part of a payment.
Attributes
- refundIdstring
- paymentIdstring
- transactionIdstring
- amountobject
An amount in minor units with its currency.
Child attributes of
amount- amountMinorinteger
The amount in the smallest unit of the currency, for example cents.
- currencystring
An ISO 4217 alphabetic currency code.
Pattern
^[A-Z]{3}$.
- statusstring
The state of the refund. See the refund lifecycle.
Your own reference for the refund. Absent when you did not send one.
- createdAtstring (date-time)
- updatedAtstring (date-time)
The response can include fields that this page does not list. Ignore fields that you do not know.
Refund a payment#
POST/
Refunds all or part of a succeeded or partially_refunded payment. Without amount, the refund is for the full amount that is not yet refunded. You can refund a payment more than once, up to the amount collected.
The refund starts in the requested state. The result arrives later, as refund.succeeded or refund.failed.
A payment that does not exist returns 422.
Requires the payments:refund scope.
Path parameters
The payment id.
Headers
A unique key for this request, at most 200 characters. A retry with the same key and body returns the first result.
At most 200 characters.
Request body
- amountobject
The amount to refund. Absent when the whole remaining amount is refunded.
Child attributes of
amountThe amount in the smallest unit of the currency, for example cents.
An ISO 4217 alphabetic currency code.
Pattern
^[A-Z]{3}$.
- referencestring
Your own reference for the refund.
- reasonstring
Why you refund the payment. At most 500 characters. It is not returned.
Returns
Errors
| Status | Meaning |
|---|---|
| 400 | The request is not valid. See the error body for the field at fault. |
| 401 | The API key is missing, malformed, revoked, or unknown. |
| 403 | The API key does not hold the scope that this operation requires. |
| 409 | The request conflicts with the current state of the resource, or the idempotency key was used with a different request. |
| 422 | The request is valid, but Merxian cannot apply it to the current data. |
| 500 | An unexpected error occurred. Retry with the same idempotency key. |
| 502 | Merxian could not complete the request. Retry with the same idempotency key. |
| 503 | Merxian could not verify the API key. Retry later. |
The error reference lists the codes in each error body.
Webhook events
This call can cause these events, later and in any order:
Retrieve a refund#
GET/
Returns one refund. A refund that does not exist, or that belongs to another account, returns 404 with an empty body.
Requires the payments:read scope.
Path parameters
The refund id.
Returns
Errors
| Status | Meaning |
|---|---|
| 401 | The API key is missing, malformed, revoked, or unknown. |
| 403 | The API key does not hold the scope that this operation requires. |
| 404 | The resource does not exist, or it belongs to another account. |
| 500 | An unexpected error occurred. Retry with the same idempotency key. |
| 502 | Merxian could not complete the request. Retry with the same idempotency key. |
| 503 | Merxian could not verify the API key. Retry later. |
The error reference lists the codes in each error body.