Direction:
Implement a Payments module integrating a payment provider (e.g., Stripe) to handle one-time charges and subscription billing, including secure webhook handling.
Key responsibilities:
- Customer and payment method creation endpoints and subscription management (create, update, cancel).
- Secure webhook endpoint to process events (invoice.payment_succeeded, charge.failed, subscription.updated) with signature verification.
- Record transactions and subscription status in the database; reconcile webhook events idempotently.
- Provide endpoints to fetch invoices and billing history for a user.
- Add tests for webhook processing, subscription lifecycle, and billing edge cases.
Acceptance criteria:
- Integration with a payment provider with sample configuration (env vars) documented.
- Webhook endpoint verifies signatures and processes events idempotently.
- Subscriptions and charges are persisted and reflected in user account state.
- Tests cover successful and failed payments, webhook retries, and idempotency.
- Docs include steps to configure test keys and simulate events.
Direction:
Implement a Payments module integrating a payment provider (e.g., Stripe) to handle one-time charges and subscription billing, including secure webhook handling.
Key responsibilities:
Acceptance criteria: