Skip to content

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.

  • Resource

new WebsitesBillingApi(opts): WebsitesBillingApi

Defined in: packages/sdk/src/request.ts:93

VantageClientOptions

WebsitesBillingApi

Resource.constructor

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.

string

Promise<{ url: string; }>


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.

string

Promise<{ website: Website; }>


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.

string

number

string

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.

Promise<{ invoice: WebsiteInvoice; }>


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.

string

Promise<WebsiteInvoicesResponse>


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.

string

number

Promise<{ hostedInvoiceUrl: string | null; subscriptionId: string; website: Website; }>


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. null when 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.

string

Partial<{ openrouter: boolean; resend: boolean; seo: boolean; }>

Promise<{ job: { jobId: string; } | null; teardowns: object[]; website: Website; }>


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.

string

number

Promise<Website>