Add organization billing webhooks bridge for Stripe events in new src/routes/billingWebhooks.ts
Description
Enterprise tenants will eventually be billed externally and Stripe webhooks need a stable receiver that verifies the Stripe-Signature header, persists the event, and dispatches via the existing job queue. Add src/routes/billingWebhooks.ts mounted at POST /api/billing/webhooks with raw-body signature validation.
Requirements and context
- Must be secure, tested, and documented
- Should be efficient and easy to review
- Use a per-route
express.raw body parser
- Persist events to a new
billing_events table
- Use idempotency from
src/services/idempotency.ts
- Add
src/routes/billingWebhooks.test.ts
- Update
docs/enterprise.md
Suggested execution
- Fork the repo and create a branch
git checkout -b feat/stripe-webhooks
- Implement changes
- Add route and migration
- Add tests and docs
- Test and commit
- Run
npm run migrate:latest && npm test
- Include test output and notes
Example commit message
feat: Stripe billing webhook receiver
Guidelines
- Minimum 95 percent test coverage
- Clear documentation
- Timeframe: 96 hours
Add organization billing webhooks bridge for Stripe events in new src/routes/billingWebhooks.ts
Description
Enterprise tenants will eventually be billed externally and Stripe webhooks need a stable receiver that verifies the
Stripe-Signatureheader, persists the event, and dispatches via the existing job queue. Addsrc/routes/billingWebhooks.tsmounted atPOST /api/billing/webhookswith raw-body signature validation.Requirements and context
express.rawbody parserbilling_eventstablesrc/services/idempotency.tssrc/routes/billingWebhooks.test.tsdocs/enterprise.mdSuggested execution
git checkout -b feat/stripe-webhooksnpm run migrate:latest && npm testExample commit message
feat: Stripe billing webhook receiverGuidelines