bhussainshoots - Processing Stripe webhooks in ...
Processing Stripe webhooks in BuildShip? If you're not handling idempotency, you're probably creating duplicate invoices when Stripe retries.
Here's the pattern that actually works:
1. Extract the idempotency key from headers (
Idempotency-Key
Idempotency-Key
or
X-Request-ID
X-Request-ID
) 2. Check Redis(or BuildShip's built-in cache) for
processed:{key}
processed:{key}
before executing business logic 3. Set TTL to 24h+ (Stripe retries for up to 3 days) 4. Return 200 immediately after caching the key, process async
Without this, a 5s timeout on your end triggers Stripe's retry, creating double entries. I've seen teams process the same $5k payment three times because their workflow took 6 seconds to complete.
Use BuildShip's Redis node with
SET key value NX EX 86400
SET key value NX EX 86400
(set if not exists, 24h expiry).
How are you handling webhook retries in your current setup?