My AI Agent Charged a Customer Twice in 11 Seconds
说明与用途
Webhook 重复处理导致双重扣费。解决方案:通过跟踪支付提供商的事件 ID,先记录再执行操作,使处理器幂等,忽略已处理的事件。
问题
Duplicate payment charges were created because the webhook handler did not dedupe repeated events, leading to a customer being charged twice.
结果
Prevented double charges by making the webhook handler idempotent; added duplicate‑event tests and nightly reconciliation to catch similar issues early.
工作流
- Receive payment.succeeded webhook
- Extract event_id from payload
- Check if event_id already processed in durable store
- If processed, return success and skip
- If not, record event_id
- Charge customer
- Provision account
- Send receipt email
- Return success
证据
The provider had sent the payment.succeeded event three times.
The fix is small enough to be almost insulting, which is the point.
- 记录日期: 2026-09-07T23:23:12.637Z