Skip to main content

Flow

1

Receive

Stripe sends webhook to billing service endpoint.
2

Validate

HMAC signature verified. Webhook record created with status PENDING.
3

Deduplicate

Check unique constraint (provider, externalRef) to prevent duplicate processing.
4

Process

Status → PROCESSING. Event type dispatched to appropriate handler.
5

Complete

Status → PROCESSED on success, FAILED on error (with retry).

Key Event Types

Stripe EventAction
invoice.paidUpdate invoice status to PAID
invoice.payment_failedUpdate invoice, set subscription to PAST_DUE
invoice.finalizedCreate/update invoice record
charge.refundedUpdate invoice to REFUNDED
charge.dispute.createdUpdate invoice to DISPUTED

Retry Policy

Failed webhooks increment attempts and can be retried. Max 3 attempts with exponential backoff.