BillingWebhookKit

Webhook idempotency checklist

Payment providers retry events, and billing code must stay correct when the same event arrives more than once.

Open the free generator

Choose an idempotency key

Use the provider event ID when available, otherwise combine provider name, event type, and stable object ID.

Record before side effects

Persist a processed-event record before granting access, sending mail, or calling external services.

Handle event ordering

Do not assume subscription_created arrives before payment_success; reconcile from stable customer and subscription IDs.

FAQ

Is idempotency only for webhooks?

No, but webhooks need it because provider retries and network failures are normal.

Should duplicate events return errors?

Usually no. Return a successful response after confirming the event has already been handled.

Use the free sample before wiring production checkout

Download a public sample pack with fake Lemon Squeezy fixtures, signature tests, contract checks, duplicate replay tests, and CI skeletons. The Pro Kit preview shows the full paid package structure without exposing the private archive.