Briefle words · Code & architecture
Idempotency key
A unique id attached to a request so the receiver can recognise a repeat and not perform the same action twice.
Say it to an AI
Express 5 + Prisma handler for payment.succeeded webhooks that credits the user's wallet. Delivery is at-least-once, so make it idempotent: use event.id as the idempotency key in a unique-keyed table and insert it plus the balance increment in one database transaction.
How an expert would brief the stronger version of “Wallet top-up webhook”.
See it
Try it as a puzzle →Endpoint in a savings app that tops up a user's wallet when the payment provider reports a successful card payment.
Why: A uses the provider's event.id as the key, stored in the webhookEvent table with skipDuplicates: true.
Related words
Room 4 · Errors & edge cases
Learn “Idempotency key” in a five-minute lesson