Overview
Thebilling client provides access to subscription management, Stripe Checkout session creation, and the Stripe Billing Portal.
Access the billing client via client.billing.
Get Subscription
Retrieve the current subscription status for the authenticated developer:SubscriptionStatus
| Field | Type | Description |
|---|---|---|
plan | str | Current plan ("free", "pro", or "enterprise"). |
status | str | Subscription status ("active", "past_due", "canceled"). |
current_period_end | str | None | ISO 8601 timestamp when the current billing period ends. |
Create Checkout
Create a Stripe Checkout session for upgrading to a paid plan. Returns a URL to redirect the user to:CreateCheckoutParams
| Parameter | Type | Required | Description |
|---|---|---|---|
plan | str | Yes | The plan to subscribe to ("pro" or "enterprise"). |
success_url | str | Yes | URL to redirect to after successful payment. |
cancel_url | str | Yes | URL to redirect to if the user cancels. |
CheckoutResponse
| Field | Type | Description |
|---|---|---|
checkout_url | str | The Stripe Checkout session URL. |
Create Portal
Create a Stripe Billing Portal session for managing an existing subscription. Returns a URL to redirect the user to:CreatePortalParams
| Parameter | Type | Required | Description |
|---|---|---|---|
return_url | str | Yes | URL to redirect to when the user exits the portal. |
PortalResponse
| Field | Type | Description |
|---|---|---|
portal_url | str | The Stripe Billing Portal session URL. |