Idempotency
How the Idempotency-Key header makes purchases, installment plans and refunds safe to retry, and what a conflict means.
View as .mdUpdated
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.| Operation | Key |
|---|---|
| POSTCreate payment intent | Required (header, or idempotency_key in the body) |
| POSTRequest installment purchase | Required (header, or idempotency_key in the body) |
| POSTSend refund | Required (header) |
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.