The problem
Your agent receives a webhook forpayment.succeeded and begins notifying the customer and updating records. But the webhook was a retry of an event that was already processed — or worse, the payment was later reversed. Acting on stale webhook state causes duplicate notifications and incorrect records.
Solution: verify state before acting on webhooks
Before executing downstream actions triggered by a webhook, usePOST /state/verify to confirm the event state still matches:
Verify payment state before notification
payment_status mismatch and returns replan_required. The notification never sends.
Handling duplicate webhook delivery
Use idempotency keys scoped to the webhook event ID to prevent duplicate processing:Next steps
- POST /state/verify — full API reference
- Reconciliation — handle unknown outcomes in webhook-triggered flows
- Execution Records — track every webhook-triggered action