

Payment gateway webhooks are server-to-server notifications that tell a merchant's backend when events such as payment success, failure, refund updates or other supported payment-state changes occur. Unlike browser redirects, they do not depend on the customer returning to the merchant website after payment. The browser can close, connectivity can disappear, or the return flow can stop midway. Payment processing may continue after that session ends. Payment gateway webhooks give the backend an asynchronous path to receive the outcome without depending on the shopper's browser. This blog follows that path from event receipt to verification, retries, recovery, monitoring, and production testing.
| A payment gateway webhook is an HTTP notification sent from a payment system to a merchant-controlled backend endpoint after a subscribed event occurs. Its payload may include an event ID, payment reference, order reference, state, timestamp, and other defined fields. The webhook reports an event without becoming part of the underlying financial transaction. |
Get Payment Webhooks (CTA)
| Question | Answer |
|---|---|
| What is a payment webhook? | A server-to-server notification triggered by a payment-related event |
| Who sends it? | The payment gateway or payment provider |
| Where does it go? | A merchant-configured backend endpoint |
| What can trigger it? | Payment success, failure, refund, dispute, subscription or other supported events |
| Does a webhook process the payment? | No. It reports an event related to the payment |
| Can a webhook be delivered more than once? | Yes. Integrations should safely handle duplicate delivery |
| Can events arrive out of order? | Yes, depending on provider and delivery conditions |
| What if the webhook is missing? | Verify payment state through the provider's status API and reconciliation process |
| Should the request be verified? | Yes, using the gateway's documented verification method |

A payment gateway webhook works by sending a server-to-server notification from the payment gateway to a merchant's backend when a subscribed payment event occurs.
A typical payment webhook flow follows these steps:
The exact payload, authentication method, acknowledgement requirement and retry behaviour vary by payment gateway. Merchants should therefore follow the current integration documentation for the provider they use.
Several communication channels can appear in one checkout, yet each serves a different purpose.
| Channel | Direction | Primary Job | Limitation |
|---|---|---|---|
| Browser redirect | Browser to merchant | Returns the shopper | Depends on session completion |
| Callback | Integration-specific | Returns transaction information | Meaning varies by integration |
| Webhook | Server to server | Pushes subscribed events | Needs backend handling |
| Status API | Merchant to payment system | Retrieves current payment state | Needs an outbound request |
Terminology differs across payment gateways. Some providers use “callback” for browser-return communication, while others use it for server-side notifications. Merchants should follow the specific definitions used in their gateway's integration documentation.
A front-end return supports the customer journey, while server-side confirmation covers a broken return path.
| A payment status webhook is a server-to-server notification that informs a merchant when the status of a payment changes. Depending on the payment gateway, a webhook may report states such as successful, failed, pending, authorised, captured, refunded, or another provider-defined payment state. |
For example, when a customer's payment moves from pending to successful, the gateway can send a payment-status event to the merchant's webhook endpoint. The merchant backend can verify the event, match it with the relevant payment or order, and update its internal record.
A payment status webhook should not be treated as the payment itself. It communicates information about a payment event. For critical unresolved states, merchants can use the gateway's server-side status API or reconciliation process to independently confirm the current payment state.
A webhook can report activity across several payment-related objects. The event type tells the merchant what changed, while the payment status explains the current state of the relevant transaction or object.
Webhook coverage varies by payment gateway and by the products a merchant has enabled. Common event families include the following.
A payment status webhook can report success, failure, or another defined change affecting a payment attempt.
These report refund creation, success, failure, pending states, or later status changes.
These notify the merchant when a chargeback or dispute is created or updated.
These cover mandate activity and recurring-payment lifecycle changes.
Where supported, these can report lifecycle changes related to payment links, such as successful payment, expiry, cancellation, or other provider-defined updates.
These cover provider-defined service or operational changes affecting payment processing that may affect transaction handling.
Each payment attempt should be classified as final, unresolved, abandoned, or reaches a final state later. The commercial order remains a separate record.
| Payment State | Meaning | Merchant Treatment |
|---|---|---|
| Successful | Final success reached | Move the eligible order workflow forward |
| Failed | One attempt ended unsuccessfully | Close that attempt only |
| Pending | Final outcome remains unresolved | Keep the attempt open |
| Abandoned | Customer left the journey | Record separately from decline |
| Delayed success | Earlier uncertainty later becomes success | Apply final state once |
Pending remains unresolved until a final state arrives. One failed attempt does not close every payment path for the order.
A payment can succeed even when its webhook never reaches the merchant endpoint. A webhook can also arrive correctly while reporting an unsuccessful payment.
The financial attempt fails to reach a successful final state. The problem exists inside the payment journey.
The payment system has an event, but the merchant endpoint does not receive it successfully or return the expected acknowledgement.
The event reaches the merchant server, yet processing breaks inside the application, database, queue, or another downstream service.
Webhook authentication mechanisms vary by gateway. Signature or HMAC verification is common, while some integrations may also support authentication credentials, IP or domain controls, timestamps, or other provider-specific protections. Use the security controls documented for the exact webhook type rather than assuming the same verification model applies across gateways.
The endpoint receiving the event does not make the event trustworthy. Before acting on a payment gateway webhook, the merchant needs enough evidence that the message is authentic and refers to the right transaction.
Dependable webhook idempotency assumes that valid events may repeat and may arrive out of chronological order.
Store a stable event identifier when one is available. A processed-event record can then recognize repeated delivery.
Repeated delivery must never create duplicate fulfillment, inventory deduction, service activation, or accounting entries.
The payment system may record the state change before the merchant receives the event. Keeping both timestamps protects payment chronology.
An older intermediate event should never overwrite a later final state. Conflicting states should move into independent verification before irreversible work continues.
The word retry can refer to very different actions inside a payment flow. Treating them as the same process can create duplicate events, repeated requests, or several payment attempts against one order.
The difference becomes clearer when each retry is separated by who starts it.
The payment system resends an existing event after an earlier delivery does not complete successfully. The main risk is processing the same event again.
The customer starts another payment attempt. A single order may then have several genuine transaction attempts.
The merchant backend repeats an outbound API request after a timeout or uncertain response. Supported idempotency controls should be used where the API provides them.
Retry timing, acknowledgement requirements, delivery guarantees, and redelivery behaviour vary by payment gateway. Merchants should follow the provider's documented webhook retry policy rather than assuming a fixed retry interval.
| Problem | What it can indicate |
|---|---|
| Payment succeeded but webhook is missing | Delivery failure, endpoint outage or delayed event |
| Same webhook received multiple times | Provider redelivery or duplicate event delivery |
| Signature verification fails | Wrong secret, altered payload or incorrect verification procedure |
| Endpoint repeatedly times out | Too much synchronous processing |
| Order remains pending | Missing final event, delayed payment state or reconciliation gap |
| Older state replaces newer state | Events processed without transition/order safeguards |
| Duplicate fulfilment occurs | Business action is not idempotent |
A webhook endpoint should complete only essential work before returning the required acknowledgement. Long tasks increase timeout and redelivery risk.
Perform the minimum verification required before acceptance, persist or enqueue the event safely, and return the acknowledgement required by the gateway. Move non-essential processing outside the request path.
Fulfillment, invoicing, customer communication, and external service calls belong outside the time-sensitive request path.
Queues and workers should absorb concurrent deliveries and backlogs that appear after traffic spikes or service interruptions.
An order, payment attempt, and webhook event represent different records. Combining them complicates retries and late state changes.
The order represents the commercial purchase and can hold or derive the expected amount, currency, fulfilment state, and overall payment outcome according to the merchant's data model.
Each attempt keeps its payment ID, order relationship, amount, payment state, timestamps, and useful transaction references.
The event record holds the event ID, event type, linked payment, gateway event timestamp, received timestamp, and processing result.
A customer may try again after an earlier attempt fails or remains unresolved. Fulfillment should follow the order outcome.
Payment truth should never depend on one notification delivery. The payment status API provides direct verification when a payment remains unresolved or conflicting.
Use a server-side lookup when the current payment state is required before a critical business action.
Compare merchant records with external payment records to find missing successes, long-running pending attempts, refund mismatches, and unmatched references.
Apply verified payment truth with an audit trail and avoid repeating any commercial action that has been completed earlier.
Webhooks should not be treated as a single endpoint metric once the system is live. Teams need to follow the event into the application and then into the payment record. Reconciliation provides the final check that payment gateway webhooks and transaction data agree.
Monitor how much traffic arrives, whether duplicate deliveries are increasing, how quickly the endpoint answers, and where delivery or acknowledgement is failing.
Look beyond the HTTP response. Queue depth, worker failures, processing time, unsuccessful jobs, and duplicate-event counts show whether the application is keeping up.
Pending payments should have an age threshold, not remain open indefinitely. Late successes, missing final states, order-payment mismatches, and abnormal retry activity should be surfaced for review.
Reconciliation tells you what the earlier layers missed. Unmatched records, open differences, a growing backlog, or discrepancies that remain unresolved for days should be visible.
Production webhook reliability depends on secure configuration, controlled change management, monitoring and clear incident ownership. These webhook best practices give teams a clearer baseline.
| Test area | What should be verified |
|---|---|
| Success | One payment produces one commercial outcome |
| Failure | A failed attempt does not incorrectly close the order |
| Pending | Later success/failure resolves safely |
| Abandonment | Checkout abandonment is not treated as a decline |
| Delayed success | Fulfilment does not occur twice |
| Duplicate events | Repeated delivery is harmless |
| Out-of-order events | Older states cannot regress a valid final state |
| Security | Invalid signatures create no business-state changes |
| Timeout | Provider retry/redelivery behaviour is handled correctly |
| Missing webhook | Status lookup/reconciliation can recover the record |
| Multiple attempts | One order reaches the correct commercial outcome |
| Refund/dispute | Events map to the correct internal records |
Reliable payment gateway integrations are designed to handle uncertainty.. Browsers disappear, events repeat, attempts remain unresolved, and notifications can arrive late. A strong backend verifies incoming events, separates attempts from orders, protects commercial actions from duplication, and preserves valid state progression. Missing information moves into controlled recovery and reconciliation. Monitoring and failure-path tests complete the model, keeping payment records dependable when individual messages or customer journeys break.
Yes. A missing payment gateway webhook can leave the merchant uncertain even though the customer’s payment was completed. The webhook only reports the event to the merchant system. When that message is missing, the transaction should be checked directly before any failure action is taken.
A payment gateway may resend an event when an earlier delivery does not receive the required acknowledgement or when its delivery mechanism retries the notification. Merchants should therefore design webhook processing to tolerate duplicate events, regardless of the provider's exact delivery guarantee. The merchant should identify previously processed events and prevent the same notification from triggering the business action again.
A missing webhook should move the payment into an independent verification process. The merchant can retrieve the current payment status through the appropriate server-side API and use reconciliation to find unresolved mismatches. A single webhook delivery should never remain the only path to payment truth.
No, one repeats communication, and the other repeats the payment attempt. A webhook retry carries an existing event back toward the merchant, while a payment retry creates another customer-side attempt that must be tracked separately.
A merchant should verify an incoming webhook before allowing it to change an order or trigger fulfillment. The usual checks include authenticity verification, required identifiers, payment amount, currency, and the relationship with the merchant’s own order record. Invalid or unmatched events should never trigger an irreversible business action.
The required response code and acknowledgement format depend on the payment gateway. Merchants should return the provider-defined success response promptly after completing the minimum safe processing required by that integration.
Yes. Payment integrations should not assume events always arrive in the same order in which the underlying state changes occurred. Store event timestamps where available and enforce valid payment-state transitions so that an older event cannot overwrite a newer confirmed state.