Guides
Payment API and webhooks: how to integrate payments reliably
A payment API creates and manages payments, while webhooks tell your system what happened afterwards, for example that a payment succeeded, failed or was refunded. Reliable integrations send every create request with an idempotency key, verify each webhook signature, treat webhooks as at-least-once and possibly out of order, and confirm the final state through the API before shipping goods.
How do payment APIs and webhooks work together?
Your server calls the API to create a payment and gets an ID and a status such as pending or requires action. The final result often arrives later: after a 3DS challenge, a bank redirect or a voucher payment. The provider then sends a webhook, an HTTP POST to your endpoint, with the event.
How do you make payment requests safe to retry?
Network timeouts happen. Send an idempotency key, a unique value per intended operation, with each create or refund request; if you retry with the same key, the provider returns the original result instead of charging twice. The IETF is standardising this as the Idempotency-Key header.
How should you handle webhooks?
Build the endpoint for duplicates, delays and order changes.
- Verify Check the signature and timestamp with your webhook secret, as in the Standard Webhooks specification.
- Acknowledge fast Return a 2xx status quickly and process the event in a queue.
- Deduplicate Store event IDs and ignore events you have already processed.
- Reconcile state Fetch the payment from the API if events arrive out of order.
- Retry safely Expect the provider to resend events that were not acknowledged.
How does OrsunPay simplify payment APIs and webhooks?
OrsunPay is a payment orchestration platform: you keep your own contracts with licensed providers (for example Stripe, Adyen or Worldpay), and OrsunPay is not a payment institution, acquirer or merchant of record and does not hold or transmit funds. OrsunPay gives you one API and one signed webhook format across connected providers, with idempotent requests and one set of payment states. For OrsunPay pricing, see the pricing page at /pricing.
Frequently asked questions
What is a webhook in payments?
An HTTP request the provider sends to your server when a payment event happens, such as a success, failure, refund or chargeback.
Why use an idempotency key?
So that retrying a request after a timeout does not create a second payment.
Can I rely only on the redirect back to my site?
No. Shoppers close tabs; confirm the result by webhook or API before fulfilling the order.
Explore OrsunPay
Talk to our teamSources
- Standard Webhooks specification (checked 2 November 2026)
- IETF RFC 9110: HTTP Semantics (checked 2 November 2026)
- IETF draft: The Idempotency-Key HTTP header field (checked 2 November 2026)
- Stripe API reference: idempotent requests (checked 2 November 2026)