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")],
    ),
)

StripePlan.proration_behavior and the request locale fields use Stripe 15 generated SDK types. Belgie Stripe is intentionally pinned to the Stripe 15 surface rather than carrying compatibility branches for newer major versions.

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:

  • StripeAccountMixin
  • StripeSubscriptionMixin

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

Notes

  • Billing flows target a generic Account, so individuals, organizations, and teams all use account_id.
  • Stripe customer creation supports both lazy creation on first billing action and automatic creation during client.sign_up() when create_account_on_sign_up=True.
  • Individual email changes are synced back to Stripe as a best-effort hook when updates go through BelgieClient.update_individual(...). Belgie-owned OAuth and SSO profile refresh flows already use that path.
  • Direct adapter calls such as adapter.update_individual(...) bypass plugin hooks by design.
  • 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.
  • Stripe support is limited to >=15,<16.

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.19.1.tar.gz (21.0 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.19.1-py3-none-any.whl (24.8 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: belgie_stripe-0.19.1.tar.gz
  • Upload date:
  • Size: 21.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.11.8 {"installer":{"name":"uv","version":"0.11.8","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for belgie_stripe-0.19.1.tar.gz
Algorithm Hash digest
SHA256 e604cde167e395ddf3a6c5438ecb4a33b5903625e67cc4d8def37e408cf22599
MD5 599ad38df566973f8b54a48aa9cceb93
BLAKE2b-256 31b188b2633a723cf41af1929e9f860160af21b4648a729ec9f8f1ed5e0ba534

See more details on using hashes here.

File details

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

File metadata

  • Download URL: belgie_stripe-0.19.1-py3-none-any.whl
  • Upload date:
  • Size: 24.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.11.8 {"installer":{"name":"uv","version":"0.11.8","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for belgie_stripe-0.19.1-py3-none-any.whl
Algorithm Hash digest
SHA256 a326fc5d8f2ba7f132e71f234c0ca991d567e695b2a6f8075c2165daa0270c54
MD5 13d5de8b2c03403beb6ba402022668c7
BLAKE2b-256 9ad9b71c084ec274c0522e3817bf687e0464a66d88631bfbf068c68a85106814

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