# Idempotency

How the Idempotency-Key header makes purchases, installment plans and refunds safe to retry, and what a conflict means.

<ShortProductTruth>Three operations move money and therefore require an `Idempotency-Key`: creating a payment intent, starting an installment purchase and sending a refund. A retry with the same key returns the first result instead of paying twice.</ShortProductTruth>

| Operation | Key |
| --- | --- |
| <ApiOperation id="createPaymentIntent" /> | Required (header, or `idempotency_key` in the body) |
| <ApiOperation id="createInstallmentPurchase" /> | Required (header, or `idempotency_key` in the body) |
| <ApiOperation id="sendRefund" /> | Required (header) |

## Behaviour [#behaviour]

| Case | Result |
| --- | --- |
| New key | The operation runs once. |
| Same key, same body | The first result is returned again; nothing new happens. |
| Same key, different body | `409 IDEMPOTENCY_CONFLICT`. |
| No key | `400 VALIDATION_ERROR`. |

Use one key per purchase, for example a UUID or `<task>-<step>`. After a timeout, retry with the same key: you will get the original intent, whatever state it reached. The MCP tool `request_purchase` takes the same key as its `idempotency_key` argument.

