Menu

Idempotent Paddle and Stripe webhooks in Laravel: order-independent sync, exactly-once credit grants, durable receipts
📰

Idempotent Paddle and Stripe webhooks in Laravel: order-independent sync, exactly-once credit grants, durable receipts

DEV Community: laravel·Keel·7 days ago
#rOVhTRWp
#devtolaravel#devto#dev#event#subscription
Long article (733 words) — no AI summary yet.
Reading 0:00
15s threshold

Webhook handlers fail in two ways that look identical in your logs but corrupt billing in opposite directions: events that arrive out of order, and events that arrive twice. Paddle and Stripe both retry, both batch, and neither promises ordering. If your handler assumes tidy sequences, a retry grants the same credits twice and a late subscription.updated overwrites a newer cancellation.

This post is the design we ship for that, from working Laravel code: three rules that make subscription sync order-independent and the money-moving side effects exactly-once in effect, without a queue of specialist infrastructure.

Rule 1: Sync the subscription from the event payload, never from sequence assumptions

A webhook handler that branches on event type ("created means insert, updated means update") breaks the day subscription.canceled arrives before the subscription.updated that was sent earlier.…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.