Content
Payment Webhooks Arrive Late or Twice: Specify the Order Recovery Outcome
Time to read: 4 minutes
A delayed capture notification can confirm an eligible order, but it must not reopen a canceled one on its own. For a payment integration handoff, specify two things separately: what the provider has verified about the payment and what the merchant still allows for the order. A redelivery can help finish incomplete work, but must not repeat a committed effect. An older notification must not undo a newer verified result.
Define the transition before testing delivery
Start with one checkout where the store saves a pending order and releases it to fulfillment only after a matching full capture. That is the policy for the example below, not a requirement for every checkout. In your spec, name the capture evidence for the specific provider, account, API version and payment method. Bind it to the accepted checkout revision and the saved order. Define the deadline for checking an unresolved order separately from any merchant deadline or decision that closes it.
Keep these three records distinct:
- Event delivery: A verified notification was received and the work was durably accepted. An acknowledgment doesn’t say what happened to the order. Stripe’s webhook documentation, for example, describes duplicate and unordered delivery. Check the actual provider’s verification and delivery contract.
- Payment: Confirm the linked payment, current outcome, amount and currency from the provider when an event is late, ambiguous or conflicts with stored evidence. Record verified captures and reversals as distinct facts; don’t let the last arrival win.
- Order: The commerce record determines whether the same pending order can still be confirmed. At that transition, one outcome wins: confirmation or cancellation of the pending order. Track the release separately; if it was already accepted, a repeated check must not release the order again.
Worked acceptance spec: the same late capture, two different order outcomes
Fictional sandbox expectations, not executed results. Pending order O-720 is linked to P-720 for USD 64.00. The provider records a full capture at 11:01 UTC. In the first two runs, the application’s first recovery check is at 11:03; the capture notification is delivered at 11:04 and redelivered at 11:05. The recovery check and webhook apply the same order rules. The only difference between these two runs is whether the merchant accepted a cancellation before the check. The times are fixture values, not provider retry rules.
| Run | Trigger and starting state | Required order outcome and evidence |
|---|---|---|
| Late capture, order still open | 11:03: provider confirms the USD 64.00 capture; the order is still eligible | O-720 becomes confirmed. Record one accepted fulfillment release against O-720 when that step completes. Both later deliveries leave the order and release count unchanged. |
| Late capture, cancellation already accepted | 11:02: merchant closes O-720; 11:03: provider confirms the same capture | O-720 stays canceled. Zero releases; one financial exception linked to the capture, assigned to the payments owner for authorized disposition. Neither delivery reopens the order or creates a second exception. |
| Webhook-first control | Defer the scheduled check until after 11:07; don’t run manual recovery. Deliver the delayed capture notification at 11:04 while O-720 is still pending and eligible. | The notification triggers confirmation of O-720 and one accepted fulfillment release by 11:05. Redeliver at 11:06, after verifying the first release. At 11:07, verify the same release ID, one order and no extra release. |
| Older failure arrives after confirmation | First run has confirmed O-720; a prior unsuccessful attempt notification for the same payment object arrives afterward; the provider still verifies the capture | Keep the failed attempt as history, not the current order state. O-720 stays confirmed and the release count remains one. |
| No notification and provider lookup unavailable | Suppress delivery for the full run. At 11:03 the lookup fails; at the scheduled follow-up it verifies capture and the order is still eligible. | Pending and zero releases at the first check. At follow-up, confirm O-720 and verify one accepted release. The flow recovers without a webhook. |
Counterexample: A refund that the provider now confirms before release is not a stale failure notice. For this fixture, a verified full refund before release blocks fulfillment and is recorded against the original order and payment. Define the separate response for a refund after release with the fulfillment and payments owners; don’t simply rewrite order history.
Accept the saved result, not the webhook response
Have the implementer demonstrate each run from the same starting conditions in an authorized sandbox. Retain the provider state and lookup time, event and delivery references, order transition history and accepted release or exception IDs. In the webhook-first run, tie the first delivery to the committed order transition and the accepted release before any scheduled reconciliation, then compare the release ID after redelivery. Keep the no-webhook run as a separate check that reconciliation works without delivery. Confirm that recovery did not create another payment or repeat the capture. Check the destination when a release acknowledgment is uncertain; a locally queued instruction is not proof of a downstream release. Ask the payments and commerce owners to agree who reviews unresolved cases and by when. No real card or customer data belongs in the fixture.
Use the API idempotency guide for receiver-specific retry, transaction-boundary and replay design. Add the open-versus-closed decision and its evidence to your checkout release tests; the checkout redesign acceptance guide covers the wider scenario set. If the demo can only prove that the endpoint said “received,” leave this acceptance item open.
Lassen Sie Profis Ihre Herausforderung meistern
Unsere zertifizierten Spezialisten finden die optimale Lösung für Ihr Unternehmen.