> This page is for Afterpay Online Developer, version v1.
> For other versions, use one of these documentation indexes:
> - Main (default): https://developers.afterpay.com/afterpay-online-developer/main/llms.txt
> - v1: https://developers.afterpay.com/afterpay-online-developer/v-1/llms.txt
> - Chinese: https://developers.afterpay.com/afterpay-online-developer/chinese/llms.txt

> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://developers.afterpay.com/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://developers.afterpay.com/_mcp/server.

# Idempotent Requests

The Afterpay API supports [idempotency](https://en.wikipedia.org/wiki/Idempotence) that allows the safe retry of requests, guaranteeing the operation is only performed once.

For example, if a [Create Refund](../../reference/payments/Create-Refund.v1.yaml/paths/~1v1~1payments~1\{orderId}~1refund~1environment:\{environment}/post) request fails with a network error, the request can be retried with the same `requestId` and `merchantReference`. This is especially important for partial refunds to ensure retry attempts are not processed as separate refunds.

Afterpay recommends that merchants generate UUIDs for use as request IDs. The resources that include a `requestId` may send back the same response for requests made with the same `requestId` for up to 24 hours.

> **Info**
>
> When performing an idempotent retry of an API request, an HTTP 409 response may be encountered. This generally indicates that the original request was received, but is still processing. Please try again in a few moments, and repeat with the same `requestId` until something other than a 409 response is received.