@gebarbilling/js
v0.4.1
Published
Browser-safe GebarBilling checkout and portal SDK.
Readme
@gebarbilling/js
Browser-safe GEBARBILLING SDK for checkout, portal, and billing-state workflows.
Install
pnpm add @gebarbilling/jsQuickstart
import { GebarBilling } from "@gebarbilling/js";
const billing = new GebarBilling({
publishableKey: import.meta.env.VITE_GEBARBILLING_PUBLISHABLE_KEY,
baseUrl: import.meta.env.VITE_GEBARBILLING_BASE_URL
});
await billing.openCheckout({ customerId: "cus_123", planId: "plan_growth" });API Summary
openCheckout, openPortal, getBillingState, redirectToCheckout, parseReturnUrl, mountEmbeddedCheckout, and unmountEmbeddedCheckout.
Common Pitfalls
Never pass secret keys to this package. It accepts publishable configuration only.
Security Defaults
- HTTPS is required for
baseUrl, checkout URLs, and portal URLs unlessallowInsecureHttpis explicitly enabled for local development. - Browser navigation validates URL schemes before opening checkout or portal links.
- Set
allowedRedirectHostsorcheckoutDomainbefore using browser navigation helpers. - API endpoint paths can be overridden with the
endpointsoption for custom gateways. Overrides must be relative paths, not absolute URLs.
