Create Refund
This endpoint performs a full or partial refund.
The refund operation is [idempotent](/v-1/idempotent-requests) if a unique `requestId` and `merchantReference` are provided.
## Successful Response (201)
Returns a [Refund object](/v-1/refund-object) in response. All request parameters will be echoed in the response. In addition, the response includes the following:
| Attribute | Type | Description |
| :----------- | :----- | :--------------------------------------------------------------------------------------------------------------------------- |
| `refundId` | string | The unique, permanent, Clearpay-generated Refund ID. |
| `refundedAt` | string | The UTC timestamp of when the refund was completed, in [ISO 8601](http://www.iso.org/iso/home/standards/iso8601.htm) format. |
## Connection Timeouts
| Timeout | Time (Seconds) |
| :------ | :------------- |
| Open | 10 |
| Read | 70 |
## Errors
In addition to the [PUT/POST Errors](/v-1/put-post-errors) applicable to all POST endpoints, the following errors are specific to Create Refund:
| HTTP Status Code | errorCode | Description |
| :-- | :-- | :-- |
| **412** <br />Precondition Failed | `precondition_failed` | The `orderId` is invalid, does not exist, or is not eligible for a refund. For example, the order was declined. |
| **422** <br />Unprocessable Entity | `invalid_amount` | The `amount` requested exceeded the amount available. |
| **422** <br />Unprocessable Entity | `unsupported_currency` | The currency of the refund does not match the currency of the order (and the Merchant account). |