Loading page...Загружаем страницу...正在加载页面...
AtlasRepo

My AI Agent Charged a Customer Twice in 11 Seconds

Description and use

Duplicate webhook processing caused double charges. Fix: make the handler idempotent by tracking the provider’s event ID, recording it before side effects, and skipping already‑seen events.

Problem

Duplicate payment charges were created because the webhook handler did not dedupe repeated events, leading to a customer being charged twice.

Outcome

Prevented double charges by making the webhook handler idempotent; added duplicate‑event tests and nightly reconciliation to catch similar issues early.

Workflow

  • 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

Evidence

The provider had sent the payment.succeeded event three times.

Source

The fix is small enough to be almost insulting, which is the point.

Source

  • Record date: 2026-09-07T23:23:12.637Z