Skip to main content

Stripe billing plugin for Belgie

Project description

Belgie Stripe: Billing and Subscription Management

Belgie Stripe adds Stripe customer creation, Checkout-based subscription acquisition, Customer Portal management, and webhook-driven subscription syncing to Belgie.

The package follows Belgie's plugin model:

  • register Stripe(...) with auth.add_plugin(...)
  • mount package-owned routes under /auth
  • optionally inject StripeClient into your own routes
  • compose explicit SQLAlchemy mixins instead of dynamic schema mapping

Installation

uv add belgie-stripe belgie-organization

For the umbrella package:

uv add belgie[alchemy,stripe,organization]

What It Provides

  • Stripe settings for Stripe billing configuration
  • StripePlugin for route mounting and dependency injection
  • StripeClient for app-owned billing flows
  • StripePlan and request/response models
  • StripeAdapter and SQLAlchemy mixins for subscription persistence

Configuration

import stripe

from belgie_stripe import Stripe, StripePlan, StripeSubscription

stripe_client = stripe.StripeClient(
    "sk_test_...",
    http_client=stripe.HTTPXClient(),
)

plugin = Stripe(
    stripe=stripe_client,
    stripe_webhook_secret="whsec_...",
    subscription=StripeSubscription(
        adapter=subscription_adapter,
        plans=[StripePlan(name="pro", price_id="price_pro", annual_price_id="price_pro_year")],
    ),
)

Route Surface

Mounted under /auth:

  • POST /stripe/webhook
  • POST /subscription/upgrade
  • GET /subscription/list
  • POST /subscription/cancel
  • POST /subscription/restore
  • POST /subscription/billing-portal
  • GET /subscription/success

Data Model

To use belgie-stripe with belgie-alchemy, compose these mixins into your models:

  • StripeUserMixin
  • StripeOrganizationMixin
  • StripeSubscriptionMixin

Unlike Better Auth, Belgie does not do schema remapping at runtime. The Stripe columns and table are explicit model definitions that live in your application code.

Notes

  • Organization subscriptions require the Belgie organization plugin and an explicit reference_id.
  • Customer creation supports both lazy creation on first billing action and automatic creation during client.sign_up() when create_customer_on_sign_up=True.
  • Injected StripeClient instances expose the raw async Stripe SDK as client.stripe for app-owned SDK calls.
  • The package is designed around Stripe Billing APIs, Checkout Sessions, and Customer Portal.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

belgie_stripe-0.1.0.tar.gz (13.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

belgie_stripe-0.1.0-py3-none-any.whl (16.5 kB view details)

Uploaded Python 3

File details

Details for the file belgie_stripe-0.1.0.tar.gz.

File metadata

  • Download URL: belgie_stripe-0.1.0.tar.gz
  • Upload date:
  • Size: 13.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.2 {"installer":{"name":"uv","version":"0.11.2","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for belgie_stripe-0.1.0.tar.gz
Algorithm Hash digest
SHA256 702da8b7a0447fffb7819143efba9bcb53c6e8c87c9b905cd74f8a605b810e11
MD5 7e876e7094bdaa5b806c6b1b0ac78ad2
BLAKE2b-256 6f60e5ce44a1645f260a95b8acd2704baf015ba354b38353552ddd6426a0bc4b

See more details on using hashes here.

File details

Details for the file belgie_stripe-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: belgie_stripe-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 16.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.2 {"installer":{"name":"uv","version":"0.11.2","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for belgie_stripe-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 cb16d02e10385a74a9e5bc2e4112cd65ffa7721facf50a4eeffd5eba6414d04d
MD5 5fbf14f56050dd1d8f3f151345ac0a6f
BLAKE2b-256 6fa1c9e592dc9ae3f3d2e4c9bb7e575b085b7e49c11afe49fd56a571873b25c4

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page