Webhooks
Restore Hub receives webhooks from billing providers β it does not currently emit outbound webhooks to your server. This page explains the inbound flow so you understand how subscription state is kept in sync.
Stripe β POST /api/billing/webhook
Stripe sends every billing event for Restore Hub customers (subscriptions, invoice payment success/failure, customer updates) to this endpoint. The handler verifies the signature against STRIPE_WEBHOOK_SECRET and updates the user's plan, billing state, and entitlements in the database.
Events we react to:
checkout.session.completedβ new subscription, attach to usercustomer.subscription.updatedβ plan change, mid-cycle upgrade/downgradecustomer.subscription.deletedβ cancellation, revert to FREE planinvoice.payment_succeededβ extend access for next periodinvoice.payment_failedβ flag account, send email, eventual downgradecharge.refundedβ credit ledger and update audit trail
Verification: every request must carry a valid Stripe-Signature header. Unverified requests get 400.
OxaPay β POST /api/oxapay/webhook
OxaPay handles cryptocurrency payments. The endpoint verifies the request hash against the merchant secret, then activates a subscription or extends a plan based on the invoice status.
States we handle:
Paidβ confirmed crypto payment, activate planConfirmingβ txn submitted, no action yetExpired/Failedβ clean up the pending invoice record
Security model
Both endpoints are public but protected by:
- Cryptographic signature verification on every request
- Idempotency: replaying the same event has no additional effect
- Rate limiting at the load balancer
- Audit-log entries on every state change
Outbound webhooks (roadmap)
Outbound webhooks β Restore Hub calling your server when something happens (member verified, backup completed, etc.) β are on the roadmap. For now, poll the API or use the MCP server from inside an agent loop.