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.