Digital Workflows and Integrations

Forged payment notifications: checking webhook authenticity before order fulfilment

Webhook signature verification, unchanged request content and negative tests before a payment notification triggers order fulfilment.

Forged payment notifications: checking webhook authenticity before order fulfilment

A payment notification must not trigger order fulfilment simply because its content looks plausible. First, verify the webhook signature according to the particular provider's protocol, preserving the original content needed for verification and checking delivery freshness. Then establish whether the event concerns the correct environment, account and order, and whether it genuinely permits the intended action. Duplicate prevention is a separate control. A valid identifier or a previously unseen event does not prove authentic origin.

Where the company starts trusting an external notification

Start the assessment with the business action, not a list of technical libraries. What happens in the system when a notification arrives? It might mark a payment, reserve goods, grant access or create a warehouse task. Find the first point where external input can cause these effects.

Ask the developer to demonstrate which check runs before that point. “We only receive data from the payment system” is not a sufficient answer. A publicly reachable endpoint is not, by itself, proof of the sender's identity. A verifiable mechanism and a clear rejection path are needed.

Imagine a system reading an order number and status from incoming text, then forwarding the order to the warehouse. If trust verification is scheduled for later, the business action may already have started. This is an illustrative design risk, not a claim about a particular company's vulnerability.

The assessment must demonstrate the sequence: a trusted event first, then an authorised action. OWASP's transaction authorisation guidance emphasises server-side controls and a final check before execution. For the integration buyer, that means asking for evidence that another input route cannot bypass the critical check.

Webhook signature verification and idempotency answer different questions

Within a particular protocol, signature verification binds the received content to the trusted signing mechanism. It is not a general guarantee that the order may be fulfilled. Even an authentic event may concern another environment or an action your system should not respond to.

An idempotency control establishes whether the effects of a particular action have already occurred. It cannot replace origin verification: a malicious request can contain a previously unseen identifier. Conversely, authenticity checking alone does not prevent repeated execution. A detailed duplicate-prevention model is covered in the article on idempotency in integrations.

Specify separate expected outcomes for these controls. A test showing that a repeated event does not create a second order does not demonstrate rejection of a forged event. If an invalid signature is rejected, you must still test whether an already processed valid event causes the same effects again.

Do not use a “verified” status without explanation. It should state whether origin, content schema, business conditions or execution history was checked. Combining these checks in one general field makes both fault diagnosis and security acceptance harder.

Why the original request content is needed

In Stripe's example, validation uses the original request content, or raw body, the Stripe-Signature header and the particular endpoint's secret. Stripe's troubleshooting documentation warns that transforming JSON, changing whitespace or otherwise reserialising content can break signature verification. Semantically similar JSON is not necessarily the same verifiable bytes.

The integration developer must therefore trace the request from receipt to validation. At what point does the framework transform its content? Does an intermediary rewrite it? Does verification receive the original stream or text later reconstructed from an object? These questions can be tested without exposing production secrets.

Preserving original content for verification does not mean keeping all payment data indefinitely in ordinary logs. Define what diagnosis requires, where the data is held and who can access it. A safely selected technical summary is often more useful for routine monitoring than a full extract of personal and payment information.

If signature verification fails, do not resolve it by disabling validation. First distinguish possible mismatches: altered content, incorrect configuration or a missing expected header. Check these possibilities in a controlled environment. An error disappearing after verification is switched off is not an integration fix.

Bind the secret, environment and time to the specific endpoint

Secret selection must come from trusted configuration. An incoming request must not arbitrarily specify a file or address from which to obtain verification material. If the integration serves several accounts, define a bounded, verifiable mapping between the endpoint and permitted account.

Stripe's documentation states that the secrets for local CLI forwarding and a dashboard-registered endpoint differ. A matching prefix does not prove matching values. This distinction is a common diagnostic issue, but not a reason to print secrets in a shared console or attach them to a support ticket.

Stripe's webhook guidance describes a signed timestamp, delivery-freshness verification and secret rotation. A new signature and timestamp are generated for redelivery. The event's original time must therefore be distinguished from the authentication data for a particular delivery.

Choose the allowed time window using the provider's documentation and the integration's operating conditions. A universal limit must not be applied to all payment systems. Include a server-clock discrepancy in acceptance testing so the team knows how it appears and who receives the warning.

Prepare a verifiable secret-change sequence: where configuration is updated, how use of the new material is confirmed and when the old material ceases to be accepted. If the provider allows a transition period, control its boundaries. Suspected compromise may require more than an ordinary planned rotation procedure; it needs an incident assessment.

A business decision remains after authenticity verification

Define which events may trigger order fulfilment at all. Having “payment” in the name is insufficient. Map the meaning of provider events to the company's order states. A test-environment event must not trigger real dispatch, and another account's payment must not confirm your order.

Check the order link, expected amount and currency, and the order's current state. These are business conditions to specify in system requirements, not the signature algorithm's job. If an order has already been cancelled or changed, an authentic older notification is not permission to ignore the new situation.

If the current payment object must be fetched separately from the provider, that step also needs trusted account configuration and a clear failure path. A failed fetch must not be treated as confirmation. An unknown state remains unknown until sufficient grounds for action have been obtained.

The business owner should be able to explain the decision in one sentence: this verified event and these satisfied conditions permitted fulfilment of this particular order. If the only explanation is “a notification arrived”, the requirements are not yet precise enough.

A work queue must not become a route around trust checks

Separate receipt and verification from longer-running order processing where appropriate. However, queued work must retain its link to the verified event. An arbitrary unprocessed request must not become a trusted execution task merely by entering an internal queue.

Establish who may write or modify queue tasks. If another system path can create the same fulfilment command without verification, a correct webhook receiver does not protect the whole process. Supplement the external entry-point check with a final control at the business action.

Design receipt acknowledgement so it does not imply unsupported business success. If a verified event cannot be durably stored for processing, a documented response is needed. Conversely, order-fulfilment failure must be distinguished from notification-receipt failure. Otherwise, the support team cannot choose the correct recovery step.

Stripe's documentation provides for redeliveries and does not guarantee event ordering. An integration test therefore cannot consist only of one ideally delivered notification. Check how the grounds for a particular action remain traceable when events arrive in a different order from the simple demonstration.

Acceptance testing: forged, altered, stale and valid events

This is a matrix for a synthetic test environment. It is not an instruction to experiment on someone else's or a production payment system. Use a test account, verification material dedicated to it and actions that cannot cause real goods to be dispatched.

Test case

Expected outcome

Additional check

Notification without the required signature information

Rejected before the business action

No warehouse task or payment-status change

Plausibly structured content with an invalid signature

Rejected

Duplicate checking does not replace authenticity verification

Content of an initially valid event has been altered

Rejected by integrity verification

No reserialised substitute is accepted

Valid signature but delivery time outside the allowed window

Stopped according to the protocol

Time verification is not disabled

Valid, current event intended for another environment or order

Does not cause the inappropriate action

Account and business links are checked separately

Valid event with satisfied business conditions

Intended test action permitted

Specific decision grounds retained

Redelivery of the same accepted event

No repeated business effects

Redelivery recorded and distinguished from a new action

For every test, retain input identity, configuration version, result and evidence of business side effects. A response code alone does not always reveal whether an action already occurred in another system. Compare the outcome with order and work-queue state too.

Change one material aspect deliberately in a negative test. Otherwise, it becomes difficult to establish whether the event was rejected because of its signature, format or something else entirely. The valid control example helps confirm that the security check has not simply blocked the whole flow.

What to do when verification starts rejecting genuine notifications

Test evidence is more than a screenshot

Bind the acceptance result to the software and configuration versions used for the test. If the receiver route or processing intermediary changes afterwards, an earlier successful example does not establish that the new configuration works. Know which checks to repeat and who decides whether to release the changes to production.

Ask for the test boundary to be explained too. Did the event follow the same route as the real integration, or was it passed directly into an internal function? Both tests can be useful, but prove different things. An internal-function test does not show what the external receiving layer does to request content.

Inspect the rejection evidence. It must distinguish a deliberately invalid signature from a test that never reached validation. If the receiver was unavailable, no business action occurred either, but that is not a successful signature-security test. A negative result needs the appropriate cause and observation, not merely an empty order list.

Return the environment to its intended state after testing. A temporary diagnostic mode must not remain an alternative acceptance route. Label synthetic events separately too, so they cannot be confused with evidence of a customer's payment. The responsible person must know which result is a test and which is a real action.

Assign responsibility for safe recovery

Maintain a safe stop: no automatic execution without sufficient grounds. Define who checks configuration and who on the business side sees stuck orders. These tasks may be related, but do not require the same access rights.

During diagnosis, compare a known test example with the current receiving route. Check recent framework, intermediary or secret-configuration changes. Separate error categories from sensitive content in logs. There is no need to send a secret or full customer-payment details to a broad support distribution list.

Manual execution must be a controlled exception with verified grounds. A “continue regardless” button is not error handling. Link the recovery plan to the manual fallback process, retaining who decided and which data supported the decision.

Distinguish observation from execution in support work. An employee may need to see the rejection category and order identity without permission to alter trusted configuration. Equally, a configuration maintainer should not silently approve all stuck orders at the same time. Set these responsibility boundaries according to the company's risk and team capacity.

List the unfinished actions and their grounds in the recovery task. Do not issue a general instruction to repeat every notification when it is unclear which have already produced effects. Compare actual system states before continuing. Leave an ambiguous case for review rather than automatically treating it as an unexecuted transaction.

Judge successful recovery by the intended process working with its controls intact. Warnings disappearing is insufficient. If error counts fell because notifications are no longer recorded or are accepted without checks, the risk remains. The verification result must demonstrate both correct acceptance and intended rejection.

Ask for evidence before automatic execution

At integration handover, ask to see a valid test event and its deliberately damaged variants. You do not need to implement cryptography yourself, but you should see that invalid cases do not trigger fulfilment and that the valid path remains functional.

For a business process automation assessment, identify the payment provider and the event that starts fulfilment. Do not send secrets. The opening question is specific: what proves that this particular notification can be trusted and this particular order may be fulfilled?