Idempotency and safe retries for billable verification calls
When each call costs money, a careless retry loop can double your bill and corrupt your data. The patterns that keep retries safe.
On this page
Only successful calls cost you
On a well-designed verification API, failed and not-found lookups are free: you are charged for a successful verification. That changes retry economics: retrying a transient network error is free until it succeeds, so a bounded retry with back-off is cheap insurance.
Cache the result against the input
Key results by the exact input (the PAN, the GSTIN) plus the day. If the same identifier comes back through your system within that window (a user resubmitting a form, a batch re-run), serve the cached result instead of paying again. Verification data does not change minute to minute.
Make batch jobs resumable
Write each row result as you get it. If the job crashes, the resume logic skips rows that already have a result. Combine with input de-duplication and a large batch costs a fraction of a naive implementation.