Menu

Polling vs Webhooks for Crypto Payment Status: A Minimal Node.js Example
📰

Polling vs Webhooks for Crypto Payment Status: A Minimal Node.js Example

DEV Community: backend·Peter Panda·about 17 hours ago
#4UGbqabX
#devtobackend#devto#dev#const#webhook
Reading 0:00
15s threshold

When you add crypto checkout to a store or SaaS app, the gateway confirms payments asynchronously. Blockchain confirmations take time, so your backend learns about a completed payment later, either because the gateway calls you (webhook) or because you ask (polling). Most production setups use both. Here is why, with a minimal Express example.

Webhooks: fast but not guaranteed

A webhook arrives seconds after the gateway sees the payment reach the required confirmations. It is the fastest way to mark an order paid. But webhooks can be delayed, retried, delivered out of order or blocked by your firewall during a deploy. If your only signal is the webhook, a missed delivery means a paid customer with an unpaid order.

Polling: slow but reliable

A scheduled job that asks the gateway for the status of every pending invoice catches anything the webhook missed.…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.