API reference
Idempotent requests
Networks fail. An idempotency key lets you retry a create without ever creating a second session for the same order.
curl https://sandbox.api.saphra.one/v1/checkout/sessions \
-H "Authorization: Bearer sk_test_…" \
-H "Idempotency-Key: order-1042" \
-H "Content-Type: application/json" \
-d '{"amount": "25.00", "success_url": "https://shop.example/thanks"}'How it works
- Send
Idempotency-KeyonPOST /v1/checkout/sessions: 8 to 128 characters, unique per order. - The first request creates the session. Any later request with the same key, from the same business, returns that same session with its current state, instead of creating another.
- Keys are remembered permanently for your business. Never reuse one for a different order.
- Two requests racing with the same key still produce exactly one session.
- The original session is returned even if the retried body differs, so build the key from the order (
order-1042), not from a random value per attempt.
