Skip to main content
Networks fail. Clients time out. Users double-click checkout buttons. The Idempotency-Key header is how you guarantee that no matter how many times you retry a request, Yonne creates the order exactly once.

How it works

Send a unique string in the Idempotency-Key header on every POST /api/v1/external/create-order call:
If Yonne receives a second request with the same key within 24 hours, it returns the original success response instead of creating a second order. The response may include:

Generating a good idempotency key

A good key encodes your internal order ID plus a retry attempt counter so you can distinguish retries from genuinely new orders:
Examples:
  • order-WEB-100245-attempt-1 — first attempt
  • order-WEB-100245-attempt-2 — retry after timeout
Never generate a new random key on each retry. If you do, Yonne will create a new order every time, and you’ll have duplicates.

The retry decision tree


Safe vs. unsafe retries


Handling a timed-out create-order

If your client times out before receiving a response, you don’t know whether Yonne created the order. Here’s what to do:

What to log on every order attempt

Always log these fields so you can reconcile duplicate concerns in support:
  • merchant_reference_id — your internal order ID
  • Idempotency-Key — the exact key you sent
  • order_id — from the Yonne response
  • tracking_id — from the Yonne response
  • HTTP status code
  • Full error payload on failure