Skip to Content
FlowPayDocs

Idempotency

Replay a request without ever creating two payments.

Creating a payment requires the Idempotency-Key header. If the network drops before you read the response, replay exactly the same request with the same key: you get the same payment back, with no duplicate.

curl -X POST "$FLOWPAY_URL/v1/payments" \
  -H "Authorization: Bearer sk_test_..." \
  -H "Idempotency-Key: order-1042-try" \
  -H "Content-Type: application/json" \
  -d '{"merchant_reference":"ORDER-1042","amount":5000,"currency":"XOF"}'
  • A replayed response carries the Idempotent-Replayed: true header.
  • Generate one key per intent (a UUID works) and keep it for retries. It is 1 to 255 characters long.
  • Reusing a key with a different request is refused (409 idempotency_key_reuse).
  • A direct payment refused when the attempt opens (invalid number, missing code…) already exists: after fixing it, replay with the same key. The otp code is not part of the comparison. See Direct payment.
  • An order reference already used with another key is refused (409 duplicate_merchant_reference): the key protects a replay, the reference protects your orders.