/** * GlyphPay connector, browser half. Framework-free: works on any site. * Talks only to the site's own checkout route; the service credential never reaches the browser. */ import { loadStripe, type Appearance } from "@stripe/stripe-js"; import { resolveReturnUrl } from "./security.js"; export interface CheckoutOptions { /** JSON posted to your checkout route, e.g. `{ cartId }`. Your server prices it; never send a trusted amount. */ order: unknown; /** Where Stripe sends the shopper after paying. Must stay on this site unless `allowCrossOriginReturn` is set. */ returnUrl: string; /** Allow an absolute return URL on another origin. Off by default. */ allowCrossOriginReturn?: boolean; /** Your site's checkout route. Default `/api/glyphpay/checkout`. */ endpoint?: string; /** Stripe Elements appearance (theme, colors, fonts). */ appearance?: Appearance; buttonText?: string; } /** * Renders `