WebsitesBillingApi
Defined in: packages/sdk/src/resources/WebsitesApi.ts:40
Billing operations on a website’s Stripe subscription — invoice listing, one-off charges, Stripe Customer Portal sessions, feature-flag patch (which can transitively change billable features), price changes, restart-after-cancel, disconnect.
Extends
Section titled “Extends”Resource
Constructors
Section titled “Constructors”Constructor
Section titled “Constructor”new WebsitesBillingApi(
opts):WebsitesBillingApi
Defined in: packages/sdk/src/request.ts:93
Parameters
Section titled “Parameters”Returns
Section titled “Returns”WebsitesBillingApi
Inherited from
Section titled “Inherited from”Resource.constructor
Methods
Section titled “Methods”billingPortal()
Section titled “billingPortal()”billingPortal(
websiteId):Promise<{url:string; }>
Defined in: packages/sdk/src/resources/WebsitesApi.ts:149
Mint a Stripe Customer Portal session for this website’s
subscription. Admin or the owning client can call. Returns
{ url } — open it to land on Stripe’s self-serve page where
the customer can update card, view all invoices, cancel, etc.
Parameters
Section titled “Parameters”websiteId
Section titled “websiteId”string
Returns
Section titled “Returns”Promise<{ url: string; }>
disconnectStripe()
Section titled “disconnectStripe()”disconnectStripe(
websiteId):Promise<{website:Website; }>
Defined in: packages/sdk/src/resources/WebsitesApi.ts:95
Admin-only: cancel the Stripe subscription on a website and clear cached product/price ids. The owning client stays linked; billing just resets to “no subscription” state. Used by the canvas “Disconnect Stripe” action.
Parameters
Section titled “Parameters”websiteId
Section titled “websiteId”string
Returns
Section titled “Returns”Promise<{ website: Website; }>
invoiceOneOff()
Section titled “invoiceOneOff()”invoiceOneOff(
websiteId,input):Promise<{invoice:WebsiteInvoice; }>
Defined in: packages/sdk/src/resources/WebsitesApi.ts:127
Admin-only one-off invoice. Charges the owning client for a
non-recurring item (custom work, extra setup, etc.). Stripe
attempts to auto-charge the client’s card on file; if that
fails the invoice stays open and the returned hostedInvoiceUrl
is where the client can pay manually.
Parameters
Section titled “Parameters”websiteId
Section titled “websiteId”string
amountUsd
Section titled “amountUsd”number
currency?
Section titled “currency?”string
description
Section titled “description”string
"send_invoice" | "charge_automatically"
“send_invoice” (default) emails the client a hosted pay link. “charge_automatically” silently bills the card on file; we fall back to email if the charge fails.
Returns
Section titled “Returns”Promise<{ invoice: WebsiteInvoice; }>
invoices()
Section titled “invoices()”invoices(
websiteId):Promise<WebsiteInvoicesResponse>
Defined in: packages/sdk/src/resources/WebsitesApi.ts:86
List recent invoices for a website. Admin or the owning client
can call. Returns up to 50 most-recent invoices, normalized
across Stripe’s shape; each carries a hostedInvoiceUrl that
(when non-null) is a Stripe-hosted page where the recipient
can view + pay the invoice.
Parameters
Section titled “Parameters”websiteId
Section titled “websiteId”string
Returns
Section titled “Returns”Promise<WebsiteInvoicesResponse>
restartBilling()
Section titled “restartBilling()”restartBilling(
websiteId,input?):Promise<{hostedInvoiceUrl:string|null;subscriptionId:string;website:Website; }>
Defined in: packages/sdk/src/resources/WebsitesApi.ts:106
Admin-only: restart billing on a site whose subscription was previously canceled. Creates a fresh Stripe subscription on the existing customer with collection_method=send_invoice; Stripe (and we) email the client a hosted pay link. Useful for re-billing after a Stripe disconnect, or pausing/resuming a client.
Parameters
Section titled “Parameters”websiteId
Section titled “websiteId”string
input?
Section titled “input?”monthlyPriceUsd?
Section titled “monthlyPriceUsd?”number
Returns
Section titled “Returns”Promise<{ hostedInvoiceUrl: string | null; subscriptionId: string; website: Website; }>
setFeatures()
Section titled “setFeatures()”setFeatures(
websiteId,patch):Promise<{job: {jobId:string; } |null;teardowns:object[];website:Website; }>
Defined in: packages/sdk/src/resources/WebsitesApi.ts:54
Toggle one or more feature flags (openrouter, resend, seo).
Returns:
website: the updated row with the new flag state.job: non-null when a flag was turned on — the new provisioning job that runs the newly-unblocked steps.nullwhen the patch only disabled features.teardowns: per-feature teardown reports for any flag that was turned off, listing the resources removed (env vars, service rows, oauth tokens, webhook subs) plus any partial-failure errors. Empty array when nothing was disabled.
Parameters
Section titled “Parameters”websiteId
Section titled “websiteId”string
Partial<{ openrouter: boolean; resend: boolean; seo: boolean; }>
Returns
Section titled “Returns”Promise<{ job: { jobId: string; } | null; teardowns: object[]; website: Website; }>
setPrice()
Section titled “setPrice()”setPrice(
websiteId,input):Promise<Website>
Defined in: packages/sdk/src/resources/WebsitesApi.ts:157
Set the monthly subscription price (whole USD). If a Stripe subscription is active, applies proration; otherwise just updates the product price for future Checkout sessions.
Parameters
Section titled “Parameters”websiteId
Section titled “websiteId”string
monthlyPriceUsd
Section titled “monthlyPriceUsd”number
Returns
Section titled “Returns”Promise<Website>