Skip to main content

Webhooks

Webhooks let the payment provider (x402) notify you asynchronously when a payment changes state (confirmed, failed, refunded). They are critical for final reconciliation — do not rely only on immediate HTTP responses.

Typical webhook events

  • payment.confirmed — payment finalized on-chain or off-chain
  • payment.failed — processing or on-chain failure
  • payment.refunded — refund processed

Security: verify the webhook

Always verify webhook authenticity. x402 likely provides either:
  • an X-Provider-Signature header (HMAC), or
  • a signing key + signature you verify with public key cryptography.
Example HMAC verification (Node):