IOSOR Learn
Send API idempotency: duplicates, retries, and money
Developer guidance for PAYG send APIs — idempotency keys, safe retries, duplicate prevention, and ledger-friendly correlation so engineering mistakes do not become finance incidents.
Lead Telecom & Routing Architect · Lausanne, CH
Timeouts happen. Load balancers retry. Mobile clients double-tap. Without idempotency, a «send once» product becomes a PAYG double charge with duplicate OTP UX. This guide is for engineering and technical product leads integrating a white-label PAYG messaging API — where every duplicate is visible in the wallet. IOSOR expects money-aware integrations: authenticated calls, correlatable debits, and client errors that never dump foreign brand payloads. Closer commercial intensity around about USD 1,000+ monthly platform usage makes duplicate discipline non-optional. Treat every send as a ledger event first and a network call second, so finance and on-call share one narrative.
Why duplicates become money problems
| Failure mode | User sees | Wallet sees. | |
|---|---|---|---|
| Client timeout + blind retry | Two OTPs / two alerts | Two debits. | |
| Non-idempotent webhook handler | Double side effects | Confusion on success. | |
| User resend stacked on auto-retry | Annoyed users | Compounded units. | |
| Missing correlation | «It failed» tickets | Unmatched ledger rows | . |
Idempotency keys that survive retries
A serious send path accepts a client-generated key (or equivalent) that is unique per business intent, not per TCP attempt. It must return the same accepted result on replay within a clear TTL window. This prevents silently creating a second debit for the same intent.
Retry budgets vs user resend
Automatic retries need a budget: max attempts, backoff, and which error classes are retryable. User-initiated resend is a different product action with its own rate limits and PAYG cost. Mixing them is how a flaky network becomes a weekend wallet event. Pair both with stop-on-low-balance and clear reject reasons so product and finance share one truth.
Buyer / engineering checklist
- Documented idempotency key semantics and TTL.
- Replay test that proves one debit for one intent.
- Separate auto-retry budget from user resend logic.
- Correlation IDs across request, message status, and PAYG ledger.
- Staging that exercises real corridors — mock green lights are not launches.
- Key hygiene and least privilege for send credentials.
- Handling of 429 and 503 codes without losing the original intent key.
- Automated alerts for high duplicate-key rejection rates.
Operational Controls and Threshold Enforcement
- «Just retry until 200» without using idempotency keys.
- Webhook handlers that are not idempotent and trigger side effects twice.
- Full secret keys or auth tokens appearing in logs or support tickets.
- Errors pasting upstream brand payloads or internal stack traces to end users.
- No way to prove to finance that a specific duplicate was prevented.
- Using timestamps as the only source of uniqueness for transactions.
- PAYG spend control.
- Second-market compliance: handover before you send.
- Check coverage before you quote volume.
Start with IOSOR
In the send console, fire one OTP or alert with a client-generated idempotency key. Force a client timeout, then replay the identical request inside the key TTL. Open the PAYG ledger: that intent must show one debit and one user-visible message. Two rows means the key never survived the retry — fix key TTL and the handler before the corridor stays Live.
IOSOR takeaway
Do: treat every send as a ledger event first. The idempotency key is unique per business intent, not per TCP attempt. Auto-retry has a budget; a user tap on resend is a different product action with its own PAYG cost.
Don't: hammer until 200 without a key, or let a non-idempotent webhook mint a second side effect. Two OTPs for one tap is a money bug, not a network story.
Was this guide helpful?
Related guides
- Webhook Signature Verification: Legacy Scheme Replay and Acceptance Gate
Audit inbound provider callbacks: decide when legacy HMAC schemes, skewed timestamps, and replay caches are safe to accept, and when to enforce a cutover gate.
- Verify MCC MNC Porting Lag Gate on Developers Routes Before Scaling
Check MCC MNC porting lag gates on developers routes before raising SMS volume, then compare verified partner routes in /tools/brief for your corridor.
- Sandbox-to-Production Webhook Replay Parity Gate for Messaging APIs
Test whether sandbox webhooks replay identical signed payloads, retry cadence, and DLR order as production — then gate the route via a partner comparison.












