Skip to content
Technology, explained from the insideAI · Software · Digital payments
TayoTechTalk.

Fintech & Payment Infrastructure

Payment Webhooks: How to Prevent Duplicate Fulfillment

By Temitayo Solomon Gbadebo · November 5, 2026

A customer pays ₦10,000 for airtime. The payment succeeds, your server receives a notification, and the customer’s balance is credited. A few seconds later, the same notification arrives again.

If the application credits another ₦10,000, the payment provider has collected once while the business has delivered twice. This can happen in an otherwise healthy integration. Reliable payment systems need a deliberate answer to repeated messages.

That answer involves three separate controls: authenticating the notification, recognizing work already done, and making the business operation safe to retry.

Why a provider sends the message again

A webhook is a server-to-server notification about an event. The provider sends an HTTP request to your application, and your application responds to acknowledge it.

Now imagine that your application saves the event, but its acknowledgement is lost on the network. The provider cannot see your database. From its perspective, delivery might have failed, so it retries.

Stripe documents duplicate webhook deliveries and warns that events are not guaranteed to arrive in generation order. Its guidance includes tracking processed event IDs and using asynchronous processing. These are normal delivery conditions an integration must handle. Source: Stripe webhook documentation.

Repeated delivery improves the chance that an important event reaches your application. The responsibility for avoiding a repeated business effect still needs to be addressed inside your system.

Start with authenticity

A public webhook endpoint can receive requests from anyone who knows its address. Before acting on a payment notification, verify it using the provider’s documented signature procedure and the appropriate secret for the environment.

Paystack’s webhook documentation describes signature validation on the raw request body and its current signing-header formats. Integration details can change, so implement the documented scheme for your account rather than copying an old code snippet without checking it. Never put signing secrets in browser code or routine logs. Source: Paystack webhook documentation.

Verification answers whether a message can be trusted as coming from the expected source. A genuine message can still be delivered twice. Authenticity and duplicate handling solve different problems.

Separate three identities

For a practical design, keep three concepts distinct:

  • The business operation: the particular order, wallet credit or airtime purchase the customer requested.
  • The provider payment: the transaction or payment object associated with that operation.
  • The notification: an event informing your application about something that happened.

One payment may produce several legitimate events over time. One event may be delivered repeatedly. A customer may also make several valid purchases with the same amount. Using the amount as a duplicate key would reject legitimate business.

A sensible implementation records the relationship between these identities. That lets support staff trace a notification back to the payment and the customer operation without treating every new message as a new sale.

Why “check, then credit” can still fail

Consider two workers receiving the same event at almost the same time. Both ask whether the wallet has already been credited. Both receive “no.” Both then add the money.

The problem is the gap between the check and the update. A stronger design enforces uniqueness in durable storage and groups related database changes into a transaction where appropriate. For example, a wallet-credit record can carry a unique business-operation identifier. The system must prevent a second credit with that identity even when requests arrive concurrently.

This is an architectural recommendation, not a complete implementation recipe. Database transactions protect the changes inside their transaction boundary. They do not automatically make an external airtime provider, a message queue and your own database commit together.

Handle external fulfillment explicitly

Suppose your worker calls an airtime supplier, the supplier delivers the airtime, and your worker crashes before saving the response. A retry now faces an uncertain outcome.

Before sending a second fulfillment request, use the supplier’s supported reference or status-query mechanism to establish what happened. Where the supplier supports idempotency keys, reuse the same key for retries of the same intended operation. Maintain a durable record of the intended fulfillment and its current outcome.

An outbox pattern can help coordinate database updates with work that must later be dispatched: save the business change and an instruction to perform the next step together, then let a worker deliver that instruction. The receiving side still needs duplicate protection. This pattern reduces a failure gap; it does not create a universal guarantee of exactly-once delivery.

API idempotency also has a defined scope

Idempotency means that repeating an operation has the same intended effect as performing it once. Payment APIs can expose a key that identifies retries.

Stripe’s API documentation explains its idempotency behavior, including differences between API versions. Its API v1 can prune keys after they are at least 24 hours old. Reusing a pruned key can create a new request. Therefore, a provider’s retry protection should not replace your own durable business records. Source: Stripe idempotent requests documentation.

Use a key for one intended operation. Retain it through that operation’s retries. Create a new identity when the customer genuinely starts a different operation. Avoid putting personal information into keys.

Acknowledge receipt without losing the work

A practical webhook flow is to verify the request, durably record or enqueue it, and promptly acknowledge successful receipt. A background worker can then perform slower processing. If durable acceptance fails, do not claim success merely to make the provider stop retrying.

Track whether an event was received, processed or moved into an exception queue. An HTTP acknowledgement means your endpoint accepted the notification; it does not necessarily mean the customer’s order has been fulfilled.

Verification and reconciliation close the remaining gaps

Paystack’s verification guide explicitly warns against delivering value twice when an integration uses both verification and webhooks. It also distinguishes the API response’s status from the transaction’s status inside the returned data. Both routes should feed the same protected fulfillment logic. Source: Paystack payment verification guide.

As an application-level check, match the payment reference, expected amount, currency and intended order before delivering value. Periodically investigate paid transactions with no fulfillment and fulfillment records with no confirmed payment.

Before launch, test duplicate notifications, concurrent workers, delayed events, a crash after fulfillment, and an unavailable database. The goal is concrete: one intended purchase should produce one intended delivery, with an explainable record when the outcome remains uncertain.