Payment, SMS and WhatsApp integrations that don't break
Third-party services fail from time to time. Your product should handle it gracefully instead of losing orders.
Sigma Fusion
· 2 min read

Modern products depend on other services: payment gateways, SMS and OTP providers, WhatsApp, courier APIs, maps and email. Each one works almost all the time, and every one of them will fail at some point. Good integration work is about planning for that.
Never trust a single response
When a customer pays, the payment page may close before your site hears back. That is why payment gateways send a separate confirmation, called a webhook, directly to your server. Orders should be confirmed from that server-side signal, and verified, never from the browser alone.
Make every action safe to repeat
Networks retry. Customers double-tap. Webhooks arrive twice. If processing the same event twice would create two orders or send two receipts, you have a bug waiting to happen. Each event should carry an ID, and your system should ignore one it has already handled.
Have a fallback
- If an OTP SMS fails, offer a retry or a WhatsApp code.
- If the courier API is down, queue the shipment and retry automatically.
- If an email bounces, flag the customer record for follow-up.
Log and alert
Every call to an outside service should be logged with its result. When failures pass a threshold, someone on the team should get a message. Silent failures are the expensive ones.
Keep secrets secret
API keys belong in server-side environment settings, never in the website's code where anyone can read them. Rotate them if a team member leaves or a key is exposed.
An integration is finished when it handles the failure cases, not when the happy path works once.


