The pattern I use for every provider
Checkout ──▶ API creates order (pending) + provider order
Buyer pays on provider UI
Provider ──webhook──▶ API: verify signature on raw body ──▶ enqueue event ──▶ 200 OK
Queue consumer: load order ──▶ already paid? stop : mark paid ──▶ fulfil ──▶ notify
Cron (every 6h): find paid & unfulfilled ──▶ fulfil
This is how the digital-products store I built works with Razorpay on Cloudflare Workers: payment events go through a Cloudflare Queue (with a dead-letter queue in production), fulfilment issues a download link that expires after 24 hours and allows five downloads, and a cron trigger every six hours completes any paid order that has no valid link.
Provider notes from real integrations
| Provider | Where I’ve used it | Notes |
|---|---|---|
| Mercado Pago | Ekonavi marketplace commerce API | PIX and crypto payments; asynchronous, so orders must wait for verified notifications |
| Razorpay | Creator digital-products store | HMAC-SHA256 webhook signatures over the raw body; payment.captured drives fulfilment |
| Stripe | Personal projects (custom product checkout, SaaS subscription) | Checkout Sessions and subscription webhooks |
What I look for when auditing an existing integration
- Does anything trust a price or a “success” flag from the browser?
- Are webhook signatures verified against the raw body?
- What happens if the same webhook arrives twice, or out of order?
- What happens if processing fails halfway?
- Is there a report of paid orders that were never fulfilled?