Back to Glossary

API & Integration

The difference between payment webhook and server-sent events

Payment webhooks use HTTP POST requests to push event data when transactions occur, while server-sent events establish persistent connections to stream real-time payment updates continuously to client applications.

Why It Matters

Choosing the wrong integration pattern costs 15-30% more in infrastructure overhead and increases payment status latency by 200-500 milliseconds. Webhooks reduce server resources by 60% compared to polling but require complex retry logic. Server-sent events eliminate polling entirely but consume persistent connections, limiting scalability to 10,000-50,000 concurrent streams per server instance.

How It Works in Practice

  1. 1Configure webhook endpoints to receive HTTP POST notifications when payment events trigger in the processor
  2. 2Establish server-sent event connections using EventSource API to maintain persistent streaming channels
  3. 3Process webhook payloads synchronously and return HTTP 200 status within 30 seconds to prevent retries
  4. 4Parse server-sent event streams continuously to update payment status in real-time without request overhead
  5. 5Implement webhook signature validation using HMAC-SHA256 to verify payload authenticity
  6. 6Handle server-sent event reconnection logic when connections drop due to network timeouts

Common Pitfalls

Webhook endpoint failures trigger exponential backoff retries that can overwhelm servers with up to 16 attempts over 24 hours

Server-sent events bypass traditional firewall rules and may violate PCI DSS network segmentation requirements for cardholder data

Missing webhook acknowledgments within timeout windows cause duplicate payment notifications leading to double processing

Key Metrics

MetricTargetFormula
Webhook Delivery Success>99.5%Successful webhook deliveries / Total webhook attempts × 100
SSE Connection Uptime>98%Active connection time / Total session duration × 100
Event Processing Latency<500msTime from payment completion to application notification

Related Terms