Skip to main content
Networks fail in the worst place: after Laces has created your order or sent the payment prompt, but before the response reaches you. Idempotency keys make the retry safe.

Where it is required

A missing key is 400 idempotency_key_required.

How it behaves

  • Keys are scoped to your API client. Another client sending the same string never collides with yours, so a key only has to be unique within your own integration.
  • A pay key is bound to the order and the phone number. Sending the same key for a different order or a different msisdn is 422.
  • Use a different key for create and for pay. They are two logical actions.

Doing it right

  1. Generate a key (a UUID is ideal) when the buyer starts the action, not when you send the request.
  2. Store it with your cart before calling Laces.
  3. On a timeout, a network error or a 5xx, retry with the same key.
Generating a fresh key on every retry turns the protection off. Two different keys are two different orders.