Skip to main content

A payment provider says its webhooks are delivered 'at least once'. What does that mean for the workflow that receives them?

Automation workflows · Intermediate 1

Short answer

It means the same event can arrive more than once, and sometimes out of order, so my workflow must be idempotent: handling an event twice must give the same result as once. I store each event ID, skip IDs I have seen, reply with a 200 quickly, do the slow work afterwards, and verify the webhook signature.

Deeper answer

The sender cannot know if I received an event unless I reply in time. If my reply is slow or lost, it sends the event again. This is normal behaviour, not a fault. So duplicates are certain over time, and the design must expect them.

The usual pattern has four parts. First, verify the signature so that nobody can post fake payments. Second, save the event ID in a table with a unique constraint; if the insert fails, I have seen this event and I stop. Third, reply 200 immediately and process afterwards, so a slow step does not cause a resend. Fourth, do not trust the order: read the current status from the provider's API if order matters. Example: 'payment captured' arriving twice must not mark two invoices paid or send two receipts. Interviewers listen for the event ID check and the fast reply.

What a strong answer covers

Answer it out loud in the mock interview about 2 min

Follow-ups to expect

Common mistakes

Learn it

Webhooks

Practice Automation workflows questions

More on this topic

Today's AI turns are used

Lessons, roadmaps, videos, practice cards and the code playground stay free with your account, with no limit.