Buildspace
Billing

Pricing Page

Render plans from the Buildspace billing catalog and send the signed-in user to Checkout.

The recommended pricing flow is:

  1. Read prices from Buildspace.
  2. Require authentication.
  3. Create Checkout through the SDK.
  4. Gate paid features from entitlements, not from the success redirect.

Browser pricing UI

import { createClient } from "@buildspacestudio/sdk/client";

const bs = createClient(process.env.NEXT_PUBLIC_BUILDSPACE_PUBLISHABLE_KEY!);

const { prices } = await bs.billing.listPrices();

Redirect the signed-in user to Checkout

await bs.billing.redirectToCheckout({
  lookupKey: "pro_monthly",
  successUrl: `${window.location.origin}/billing/success`,
  cancelUrl: `${window.location.origin}/billing`,
});

Browser billing calls use the signed-in Buildspace user context. If your app needs explicit userId or appUserId, create Checkout from server code with the server SDK instead.

Server-side Checkout

import Buildspace from "@buildspacestudio/sdk";

const bs = new Buildspace(process.env.BUILDSPACE_SECRET_KEY!);

const checkout = await bs.billing.createCheckout({
  appUserId: "customer_123",
  lookupKey: "pro_monthly",
  successUrl: "https://app.example.com/billing/success",
  cancelUrl: "https://app.example.com/billing",
});

Use server-side Checkout when:

  • your app uses its own auth system instead of Buildspace auth
  • you need to bind billing to an explicit appUserId
  • you are starting Checkout from a server action or API route

On this page