Production Checklist for OTP Integrations: Retries, Timeouts and Safe Order Handling
An integration that works in testing can still lose money in production. Most problems come from the same few mistakes. Use this checklist before you go live with the OtpGet API.
1. Set sensible timeouts
Use a timeout of roughly 10 to 15 seconds on every request. A call without a timeout can hang your worker for minutes.
2. Never retry a purchase blindly
If getNumber times out, you do not know whether the order was created. A blind retry can buy twice. Before retrying, look for a recent order on your account or in your records.
3. Retry reads freely, but slowly
getStatus, getBalance and the list calls are safe to repeat. Poll every few seconds, and use webhooks where you can.
4. Make webhooks idempotent
The same message can rarely arrive twice. Treat the order id plus the code as a unique key and ignore a repeat. Always verify the signature.
5. Always close the order
- Cancel numbers you will not use, which refunds you.
- Finish orders that succeeded.
- Set a maximum wait time in your own system and cancel when it passes.
6. Handle every error reply
Map NO_NUMBERS to "try another server", NO_BALANCE to "alert an admin", and log anything you do not recognize.
7. Lock down the key
Allowed IPs, a daily buy limit, and the key stored outside your code. See our security guide for details.
8. Monitor
- Alert when your OtpGet balance drops below a threshold.
- Track success rate per service and per server.
- Log the order id of every purchase and every status change.
9. Test failure on purpose
With the sandbox key, test an empty balance, a bad key, a cancelled order and a webhook that your server fails to answer. If your system survives that, it will survive launch day.
Start building with OtpGet
Create a free account at otpget.com, copy your API key from the dashboard and open the API documentation. Our support team is available 24/7 if you get stuck.