Skip to main content
Next Defence - Next-Gen AI Cyber Security Firm
Australia & New Zealand[email protected](02) 9064 2614
INSIGHT

E-Commerce Payment Webhooks: Prevent Signed Callback Replay and Refund Duplication

A payment provider's valid signature proves the authenticity of a callback within the scheme's assumptions; it does not guarantee that the merchant should perform an action twice.

Signed payment webhook replay: protect the transaction state machine

A payment provider’s valid signature proves the authenticity of a callback within the scheme’s assumptions; it does not guarantee that the merchant should perform an action twice. Test the webhook consumer with a fabricated paid order, a legitimate retried callback and an attacker-controlled replay of an old signed message. The application should bind events to the original order, expected state transition and unique provider event identifier before issuing a refund or credit.

Include out-of-order events, partial refunds and a message whose amount or currency conflicts with the merchant’s order record. Record idempotency results in the payment ledger and ensure reconciliation can explain why a callback was ignored. Rotate secrets when exposure is demonstrated, but do not let emergency key changes create a backlog that later duplicates settled transactions. The business sign-off belongs to both payment engineering and finance, using a synthetic ledger that proves one financial effect per authorised event. Signature validation, correct customer authorisation and settlement reconciliation are separate controls requiring separate evidence.

Keep genuine settlement notifications working

The merchant still needs to receive one genuine settlement notice for the correct order. Use a payment sandbox to preserve that permitted event while temporarily restricting callbacks whose order, merchant, event identifier or processing state cannot be validated.

Trace callback identifiers and ledger changes

The investigation must distinguish what could happen from what demonstrably did happen: Correlate gateway event ID, merchant, order, idempotency key, ledger transition and retry behaviour in a payment sandbox. The operating consequence to prevent is A correctly signed duplicate callback triggers two refunds or alters a different customer’s settlement record. Establish which evidence proves the receiving system’s decision before accepting closure.

The desired state is Single-settlement proof using duplicate, delayed and cross-order event tests. Confirm this outcome against the authorised service: A payment processor delivers one genuine settlement notification to the correct test order. A replacement integration or support account should have no broader permission than that task requires.

Reject replayed, delayed and cross-order callbacks

One acceptance check should demonstrate the correct operation: A payment processor delivers one genuine settlement notification to the correct test order. A separate negative check concerns A correctly signed duplicate callback triggers two refunds or alters a different customer’s settlement record. Document both responses using the available evidence: Correlate gateway event ID, merchant, order, idempotency key, ledger transition and retry behaviour in a payment sandbox.

The work should result in Single-settlement proof using duplicate, delayed and cross-order event tests. Consider whether this assumption could change the conclusion: A stale callback reverts a completed chargeback dispute. Confirm the test’s limitations and name the operational owner.

Approve payment-state remediation with owners

An independent trial should refuse a correctly signed duplicate callback triggers two refunds or alters a different customer’s settlement record. The relevant observation sources are: Correlate gateway event ID, merchant, order, idempotency key, ledger transition and retry behaviour in a payment sandbox. The target arrangement is Single-settlement proof using duplicate, delayed and cross-order event tests.

Refund race conditions and asynchronous settlement

An attacker can replay a valid callback while the merchant’s system is processing an authorised partial refund. Simulate two concurrent copies of the same event and verify the database uses an atomic state transition or uniqueness rule so only one financial action is created. Then deliver the provider’s settlement confirmation before the original authorisation event to test safe handling of out-of-order messages. The consumer should queue or reconcile unexpected order rather than guessing the next state.

Refund authority should be bound to a customer transaction, eligible item and remaining refundable amount. A signed message referencing another customer’s order must not create store credit merely because the signature is valid. Reconciliation should compare provider ledger, merchant ledger and bank settlement totals for synthetic orders, with a clear owner for each discrepancy. A timeout or retry is an operations case, not permission to issue another independent payment.

Designing an auditable reconciliation exception

When the merchant ledger and provider settlement disagree, place the synthetic order into a review queue instead of emitting another refund automatically. Record the provider event identifier, transaction amount, original currency, remaining refundable balance and reason the mismatch requires finance approval. An engineer should not be able to suppress that exception merely by replaying a callback with a fresh transport timestamp. The finance owner should confirm the ledger adjustment before any subsequent customer notification.

Protect the refund authority beyond the webhook handler

Even a correctly deduplicated callback must not grant a general right to issue refunds. The merchant’s settlement service should check the original payer, authorised refund amount, order state and finance approval before a provider event can produce a financial effect. Include a case where the same signed callback arrives after a customer service agent has already issued a partial refund. The second event must reconcile to the existing transaction instead of creating a new credit. Keep provider and merchant event identifiers together so later disputes can be traced without exposing payment credentials.

Recovery of delayed callbacks after key rotation

If the webhook signing key was rotated mid-incident, check that delayed messages signed with the old key are not blindly replayed into production. Reconcile those messages with provider settlement records using their original event identifiers and a controlled exception queue. A missing callback may require a provider API reconciliation, not a new refund request. The financial-control owner should sign the final adjustment list before the payment integration returns to unattended processing.

Sources and further reading

Explore Next Defence expertise

Next Defence can help merchant application and payment owners test whether signed payment events are bound to the correct order and permitted state transition. A payment sandbox can replay duplicate, delayed and cross-order callbacks, then compare event IDs, settlement records and idempotency decisions. The intended result is one authorised settlement outcome without duplicate refunds or another customer’s record being changed.

Explore Application Security & DevSecOps ↗

LET'S TALK

Let’s talk about your security.

Tell us what you are protecting, where you need greater visibility or what you want to achieve. We will help identify the right next step.

Talk to a Security Specialist

Describe your security requirements. Please do not submit passwords, credentials or confidential incident evidence. This form is not an emergency incident-response channel.

Form powered by HubSpot. Review our Privacy Policy. If the form doesn’t load, email [email protected].