Add Chargebee as alternative billing provider#4
Merged
Conversation
- Add BILLING_PROVIDER env var (defaults to 'stripe') - Add Chargebee config: SITE, API_KEY, PRO_ITEM_PRICE_ID - Add Chargebee webhook Basic Auth: USERNAME, PASSWORD
- Rename class for provider-agnostic billing - Add provider column to track event source - Update webhooks.py import and usage
- Provider-agnostic field name for multi-provider support - Updated all references in models, billing, portal, webhooks
- Provider conditional in billing.py (Stripe or Chargebee) - Chargebee: HostedPage checkout, PortalSession, webhook handling - Success handler accepts both session_id (Stripe) and id (Chargebee) - Add chargebee>=3.0.0 dependency
- Stripe: /stripe/webhook with signature verification - Chargebee: /chargebee/webhook with Basic Auth - Events: subscription_created/cancelled, payment_failed
- Remove subscription_created handler (upgrades handled via redirect flow) - Require Basic Auth credentials in production (reject if missing) - Allow unauthenticated webhooks only in debug mode for local testing - Clean up imports, move Workspace import to module level - Add PortalSessionWrapper for consistent .url interface with Stripe
- Add warning about choosing provider before production - Document Chargebee setup and configuration - Update field names (billing_customer_id, BillingEvent) - Add provider comparison table - Document webhook differences between providers
- Remove verbose debug logging from upgrade flow - Update docstrings and comments to be provider-neutral - Simplify billing portal error handling - Update uv.lock with chargebee dependency
737b44f to
2776e84
Compare
- Check HostedBilling.create_portal_session method exists - Add BillingEvent model check with provider field - Verify billing webhook route exists (stripe or chargebee)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds Chargebee support alongside Stripe. Provider selected via
BILLING_PROVIDERenv var.Changes:
HostedBillingclass with identical interface for both providersstripe_customer_id→billing_customer_id,StripeEvent→BillingEventNote: Choose provider before production—switching requires manual customer migration.