Stripe Functions

Five generated Edge Functions that power your entire monetization backend — from checkout to entitlements.

stripe-checkout

Creates a real Stripe Checkout Session. Supports inline prices (amount + product) and price IDs (priceId). Returns a checkoutUrl. The extension redirects the user to Stripe — this function never handles card details.

// Creates the session and returns its URL — use billing.checkout() instead
// if you want ChromeShip to open that URL in a new tab automatically.
const { checkoutUrl } = await billing.createCheckout({
  mode: "payment",
  product: { name: "Pro" },
  amount: 19900,
});

stripe-webhook

Receives Stripe events (checkout completed, subscription updated, etc.). Verifies the HMAC signature, then creates or updates entitlements in a chromeship_entitlements table. Deduplicates events via a chromeship_stripe_events table. Register this URL in your Stripe webhook dashboard.

stripe-entitlements

Returns the signed-in user's entitlements from the chromeship_entitlements table. Called by billing.hasAccess() and billing.requireAccess(). Protected by Supabase RLS — users can only read their own entitlements.

stripe-portal

Creates a Stripe Customer Portal session. Returns a portalUrl where users manage payment methods, cancel subscriptions, or switch plans. Called by billing.portal().

stripe-catalog

Lists active prices and products from Stripe. Returns name, description, amount, currency, and interval for each plan. Called by billing.catalog().

const plans = await billing.catalog();
// [{ priceId, name, amount: 19900, currency: "eur", interval: null, ... }]