Stripe
Monetize your extension. Stripe Checkout, Customer Portal, and entitlements — all through Supabase Edge Functions. Your Stripe secret key never reaches the extension.
Requires ChromeShip Pro
Upgrade to Pro to unlock Stripe.
Checkout — send users to pay
billing.checkout opens a Stripe Checkout page in a new tab. Pass a priceId for subscriptions, or amount + product for one-off payments. billing.createCheckout returns the URL without opening a tab.
import { billing } from "@/integrations/stripe";
// One-off payment
await billing.checkout({ mode: "payment", product: { name: "Pro" }, amount: 19900 });
// Subscription with trial
await billing.checkout({ mode: "subscription", priceId: "price_xxx", trialDays: 7 });
// Raw — get the URL, open it yourself
const { checkoutUrl } = await billing.createCheckout({ mode: "payment", amount: 19900 });Portal — let users manage their subscription
Opens the Stripe Customer Portal where users can update payment methods, cancel, or switch plans. No UI to build.
await billing.portal();
const { portalUrl } = await billing.createPortal(); // URL-only versionEntitlements — gate paid features
billing.hasAccess("pro") checks if the current user paid. billing.requireAccess("pro") throws if not entitled. billing.onAccessChange refreshes the UI when entitlements change. The real gate is server-side in your Edge Functions — client checks are display only.
import { billing } from "@/integrations/stripe";
import { ChromeShipError } from "@/integrations/shared";
const hasPro = await billing.hasAccess("pro");
try {
await billing.requireAccess("pro");
// ...run the paid feature
} catch (error) {
if (error instanceof ChromeShipError && error.code === "entitlement_required") {
await billing.checkout({ mode: "payment", priceId: "price_xxx" });
}
}
// Shortcut: run a callback only if entitled
await billing.withAccess("pro", async () => runPaidFeature());
// Listen for access changes across surfaces
billing.onAccessChange((cache) => { /* show/hide premium UI */ });Catalog — render pricing from Stripe
Fetch active prices and products from Stripe. Render your pricing page from live data — no hardcoded price IDs.
const plans = await billing.catalog();
// [{ priceId, productId, name, amount, currency, interval, ... }]