Skip to main content

Designing Reliable Payment Webhook Ingestion on AWS

Updated Markdown
Designing Reliable Payment Webhook Ingestion on AWS

How to verify provider notifications, handle duplicates and recover unresolved payment states.

A payment webhook creates three separate questions:

  1. Did this request pass the provider’s verification checks?
  2. Have we stored the notification for processing?
  3. Have we committed the correct payment-state transition? Treating those as one operation makes failure recovery harder. A valid signature does not prove that processing succeeded, and an HTTP acknowledgement does not prove that your ledger is correct.

This guide outlines an AWS architecture option and the decisions to validate before implementation. It is architecture guidance, not a production-ready implementation or a compliance assessment.

  1. Follow the provider’s verification protocol Webhook verification is provider-specific.

Stripe requires the unmodified request body, the signature header and the endpoint secret. Its documentation also explains that notifications can be duplicated and delivered out of order. Use its supported verification library rather than designing a generic replacement.

Stripe webhook documentation

Adyen illustrates why a universal raw-body rule is misleading. Its Standard webhooks use an HMAC signature calculated from specified fields, carried in additionalData. Other webhook types can use a header signature calculated over the request body.

Parsing fields for verification is different from trusting those fields to update payment state.

Adyen HMAC verification documentation

Before implementation, establish:

  • Which webhook type and verification library you support.
  • What data the provider signs.
  • How your gateway and middleware preserve that data.
  • Whether the protocol includes timestamp validation.
  • How verification behaves during secret rollover. Do not impose a universal 300-second replay window. Follow the relevant provider contract, and handle duplicate business effects separately.
  1. Define the acknowledgement boundary One AWS design option is:

API Gateway → verification Lambda → SQS → processing Lambda

This separates external verification from downstream processing. It also introduces additional components, permissions and recovery paths, so assess whether that complexity fits your workload.

For this design, acknowledge successful receipt only after the verified notification reaches the agreed durable intake. Receiving a request in function memory is insufficient.

Keep the acknowledgement path short. Stripe recommends returning a successful response before complex business processing.

The architectural question is: What durable record lets us recover if this process stops immediately after acknowledging the request?

If event registration and queue publication are separate writes, account for a crash between them. A persistent pending record with a recoverable dispatcher is one possible approach.

Document how unpublished or unfinished work becomes visible again. 3. Separate secret storage from secret rotation Give each workload only the access it needs.

An ingress verifier may need a provider’s verification secret. A downstream processor may need different permissions. Avoid distributing every provider credential to every component.

AWS Secrets Manager supports encrypted storage and access controls. However, an authorised application retrieving a secret can use its value in memory. Encryption at rest does not make that secret inaccessible to the application.

AWS Secrets Manager best practices

Rotation needs a coordinated process. Updating a stored value does not, by itself, change the credential used by an external provider.

Plan and test:

  • Provider-side rollover.
  • Any supported overlap between old and new secrets.
  • Application cache refresh.
  • Verification failures during propagation.
  • Recovery if the transition fails. AWS Secrets Manager rotation documentation
  1. Make duplicate processing safe Lambda’s SQS integration can process a record more than once. By default, a failed batch can also cause successfully processed records to be retried. Partial batch responses allow the function to identify failed records, but duplicate-safe application logic remains necessary.

Using Lambda with Amazon SQS

Choose a deduplication identity appropriate to the provider, account context and event or business operation.

Then distinguish:

  • Work received.
  • Work claimed by a processor.
  • Work still in progress.
  • A business effect successfully committed.
  • Work requiring recovery. A “seen” flag is insufficient if it is written before the business update and then prevents recovery after a crash.

Ask what happens if two workers process the same notification concurrently, or one stops immediately before or after committing a transition.

5. Respect transaction boundaries For state held in DynamoDB, transactions can group eligible writes into an atomic operation within the same AWS account and Region.

That boundary does not extend to a separate payment-provider API call.

DynamoDB transaction documentation

If processing requires both a local update and an external action, document the recovery protocol between them.

For example:

  • How is unfinished external work recorded?
  • What identity is used when retrying it?
  • How is an unknown provider outcome investigated?
  • What prevents recovery from repeating an already completed effect? A database transaction cannot answer those integration questions on its own.
  1. Reconcile unresolved outcomes deliberately Authorisation, capture, refund and settlement are different questions. Define which provider API or report supplies the evidence needed for each local transition.

Choose reconciliation intervals and look-back periods from the provider’s behaviour, API limits, business deadlines and operational capacity.

There is no universal 24-hour cutoff established by this architecture.

A useful reconciliation design should explain how it:

  • Finds unresolved records.
  • Saves progress through the investigation.
  • Retries failed lookups.
  • Records discrepancies needing human review.
  • Distinguishes a successful job execution from successfully resolving every payment. Avoid overwriting financial records solely because a later notification contains a different status label.
  1. Test the failure paths before rollout Use the following as an engineering review checklist, adapted to your implementation: Scenario Question to resolve Invalid or modified signature, Can unverified data reach business processing? Duplicate notification Can the same payment effect happen twice? Concurrent processing What coordinates competing workers? Intake failure What response causes the provider to retry appropriately? Crash around a state transition Can processing recover without losing or repeating work? Secret rollover Can the verifier handle the provider’s transition behaviour? Failed reconciliation lookup Does the payment remain visible for investigation?

Record expected acknowledgements, persisted state, retry behaviour and accountable owners.

Keep diagnostic logging proportionate. Review payloads and error paths for credentials and payment data, and define access and retention controls.

The output should be a reviewable architecture decision: what you chose, why it fits the workload, what remains uncertain and which tests support the design. Bring one unresolved decision If your team is unsure where webhook acknowledgement, payment-state ownership or recovery should sit, the £950 Payments Architecture Health Check provides a focused second opinion on one AWS payments architecture decision.

Scope is agreed before paid work. The output is a written assessment, recommendation and follow-up checks for your engineers.

Explore the Payments Architecture Health Check

Sources reviewed and article updated: 22 November 2026. Architecture options and checklists are recommendations to validate in your environment.

About the author

  • We help CTOs and VP Engineering teams at Series A-C fintechs get audit-ready, acquirer-ready, and agentic-payment-ready — without the £200K consulting engagement. 25 purpose-built tools covering PCI-DSS v4.0.1, agentic payment infrastructure, acquirer due diligence, and AWS payment architecture. Based in London. Platform at syncyourcloud.io

No comments yet. Be the first to comment.