Documentation IndexFetch the complete documentation index at: /llms.txtUse this file to discover all available pages before exploring further.
Fetch the complete documentation index at: /llms.txt
Use this file to discover all available pages before exploring further.
Create and manage subscriptions server-side.
const subscription = await billing.createSubscription({ customerId: "cus_123", priceId: "price_pro_monthly", metadata: { source: "api" }, });
customerId
string
priceId
metadata
Record<string, any>
const subscription = await billing.getSubscription("sub_123");
const updated = await billing.updateSubscription("sub_123", { priceId: "price_enterprise_monthly", cancelAtPeriodEnd: false, });
// Cancel at end of billing period (default) await billing.cancelSubscription("sub_123");
await billing.reactivateSubscription("sub_123");
interface Subscription { id: string customerId: string stripeSubscriptionId?: string status: "active" | "past_due" | "canceled" | "incomplete" | "trialing" currentPeriodStart?: Date currentPeriodEnd?: Date cancelAtPeriodEnd: boolean metadata?: Record<string, any> createdAt: Date updatedAt: Date }