We built a custom checkout and occasionally a customer gets charged twice or pays without an order appearing in our database—why?
Never trust the browser redirect URL alone to create orders; fulfill strictly via idempotent server-side webhooks verified with cryptographic signatures.
Every custom-checkout rookie makes the exact same mistake: creating the order only when the customer's browser lands back on `/thank-you?status=success`. On real mobile networks, shoppers close the tab right after tapping Pay inside their bank app, lose signal on a train, or double-click back—leaving you with money in Stripe/Razorpay and zero order record in your database.
Production payment engineering flips that dependency completely. Your database writes a `pending` order record before opening the gateway session, attaches a unique idempotency key so network retries never charge twice, and marks the order `paid` strictly inside a server-side webhook listener after verifying the gateway's cryptographic signature.
Your `/thank-you` screen simply polls or reads that order status cleanly. Even if the buyer's phone battery dies the exact millisecond payment clears, the webhook arrives seconds later and triggers fulfillment reliably.
Checklist & Red Flags
- Verify gateway webhook signatures cryptographically on the server before updating any order status.
- Use unique idempotency keys per checkout attempt and handle duplicate webhook deliveries safely without double-fulfilling.
- Never rely on client-side success redirects as proof of payment.
- Build a daily reconciliation check comparing gateway captured charges against internal paid order records.
Custom Software
Need a clear architecture & milestone scope?
Talk directly with a senior Netlex MultiTech engineer — no account-manager fluff or padded quotes.
Explore Custom Software
