Skip to main content
Use signed webhook events to update your backend when a payment completes, fails, is refunded, or is reversed. Continue processing events even after the user closes PaymentSheet.

Event types

Payload

Events carry an intent snapshot in data.intent. Failure events also include data.reason; refund and reversal events include data.refund or data.reversal. Local amounts are int64 strings. Store webhook_event_id as the deduplication key and data.intent.id as the payment identifier.

Verify the request

Webhook requests include these headers:
  1. Select the outbound webhook secret for the key ID and environment. This is separate from your API signing secret.
  2. Read the exact raw request body bytes. Check the timestamp against your allowed clock window and validate the nonce and signature formats.
  3. Build the HMAC canonical string with POST, your endpoint’s pathname including its query string, timestamp, nonce, and SHA-256 body hash. Include the trailing newline.
  4. Compare the received and computed signatures in constant time. Reject malformed signatures, including a different decoded length.
  5. Check and record the nonce atomically to reject request replays. Verify the signature before storing the event or changing payment state.
Do not parse and re-serialize JSON before verification. Whitespace changes produce a different body hash.

Acknowledge and reconcile

  • Return 2xx after durably storing the verified event. An already-stored event may be acknowledged again without repeating its accounting effects.
  • Deduplicate by webhook_event_id. Delivery is at least once, and ordering is not guaranteed.
  • Network and 5xx failures are retried with backoff up to the configured attempt limit. Exhausted deliveries are retained for operator replay.
  • A 4xx response is treated as a permanent failure and is not automatically retried. Return 5xx when a temporary storage failure prevents acceptance.
  • Retrieve GET /v1/payment_intents/{id} when events arrive out of order or local state is uncertain. See Reconciliation.
Platform Payouts webhooks documents the payout payload and event types.