Stripe billing events webhook
Webhooks
Stripe billing events webhook
Receives billing and subscription lifecycle events from Stripe.
POST
Stripe billing events webhook
This endpoint requires authentication. Include your Bearer token in the Authorization header.
Description
Authentication: Requiresstripe-signature header with HMAC-SHA256 signature.
Supported Event Types:
customer.subscription.created- New subscription createdcustomer.subscription.updated- Subscription modifiedcustomer.subscription.deleted- Subscription cancelledcustomer.subscription.pending_update_applied- Pending changes appliedcustomer.subscription.pending_update_expired- Pending changes expiredinvoice.payment_succeeded- Payment successfulinvoice.payment_failed- Payment failedinvoice.created- Invoice generatedinvoice.finalized- Invoice finalizedinvoice.sent- Invoice sent to customerinvoice.paid- Invoice paidinvoice.payment_action_required- Customer action neededinvoice.overdue- Invoice past duecheckout.session.completed- Checkout completedcheckout.session.async_payment_succeeded- Async payment succeededcustomer.created- Customer createdcustomer.updated- Customer updatedbilling.meter.created- Usage meter createdbilling.meter.updated- Usage meter updatedbilling.meter.deactivated- Usage meter deactivatedbilling.meter.reactivated- Usage meter reactivated
- Verifies webhook signature using Stripe SDK
- Routes event to appropriate handler based on event type
- Syncs subscription data to local TenantSubscription model
- Invalidates and updates subscription cache
- Triggers revenue recovery workflows for failed payments
- Logs comprehensive event details to GCP Cloud Logging
Code Examples
Body
application/json
Stripe Event object (structure varies by event type)
Unique Stripe event ID
Example:
"evt_1234567890abcdef"
Event type identifier
Example:
"customer.subscription.updated"
Event data containing the affected resource
Stripe API version
Example:
"2024-06-20"
Unix timestamp when event was created
Example:
1705939200