Stripe webhooks in FastAPI: signature check and idempotent handlers
Stripe retries webhooks, delivers them out of order, and anyone who finds your endpoint can POST to it. A handler that trusts the request or runs twice will eventually corrupt a customer's plan. Two rules fix most of it: verify the signature, and make processing idempotent. 1.