Responding
Answer quickly, work later
Section titled “Answer quickly, work later”Paydot allows 3 seconds to connect and 5 seconds for the response. Anything slower counts as a failure and is retried. A slow handler produces duplicate deliveries instead of a late success.
Return a 2xx as soon as the event is safely queued, not once your downstream work has finished.
// Good: acknowledge first, process out of band.enqueue(event);res.sendStatus(202);Deduplicate on the event id
Section titled “Deduplicate on the event id”Delivery is at least once. A retry reuses the same Paydot-Event-Id, so recording processed ids is
enough to make your handler idempotent.
INSERT INTO processed_webhooks (event_id) VALUES ($1)ON CONFLICT (event_id) DO NOTHING;A single payment can legitimately produce several different events (EXECUTED then SETTLED), so
deduplicating on the payment id instead would silently drop a real status change.
Ordering is not guaranteed
Section titled “Ordering is not guaranteed”Events can arrive out of order. Use data.payment.updatedAt, not arrival order, when deciding which of two
events is newer.