Create Refund

This endpoint performs a full or partial refund.

<Note title="Note">

The refund operation is idempotent if a unique requestId and merchantReference are provided. </Note>

<Note title="Note">

If using the Deferred Payment Flow, please be aware that only captured funds can be refunded. </Note>

Successful Response (201)

Returns a Refund object in response. All request parameters will be echoed in the response. In addition, the response includes the following:

AttributeTypeDescription
refundIdstringThe unique, permanent, Clearpay-generated Refund ID.
refundedAtstringThe UTC timestamp of when the refund was completed, in ISO 8601 format.

Connection Timeouts

TimeoutTime (Seconds)
Open10
Read70

Errors

In addition to the PUT/POST Errors applicable to all POST endpoints, the following errors are specific to Create Refund:

HTTP Status CodeerrorCodeDescription
412 <br />Precondition Failedprecondition_failedThe orderId is invalid, does not exist, or is not eligible for a refund. For example, the order was declined.
422 <br />Unprocessable Entityinvalid_objectThe refundMerchantReference exceeded 128 characters.
422 <br />Unprocessable Entityinvalid_amountThe amount requested exceeded the amount available.
422 <br />Unprocessable Entityinvalid_objectThe currency of the refund does not match the currency of the order (and the Merchant account).
post/v2/payments/{orderId}/refund

Request

  • Base URL: https://global-api-sandbox.afterpay.com
  • URL: https://global-api-sandbox.afterpay.com/v2/payments/{orderId}/refund
  • Auth: HTTP basic

Path parameters

orderIdstring required

The unique Clearpay Order ID to apply the refund to.

Headers

User-Agentstring required
Acceptstring

Request body

requestIdstring

A unique request ID, required for safe retries. It is recommended that the merchant generate a UUID for each unique refund.

merchantReferencestring

The merchant’s internal refund id/reference. This must be included along with the requestId to utilise idempotency. Max length 85 (varchar)

refundMerchantReferencestring

A unique reference for the individual refund event. If provided, the value will appear in the daily settlement file as "Payment Event ID". Limited to 128 characters.

Response

Successful response

Changes

No recorded changes to this operation across all 1 revision of this API.