The price point identifier.
createClientSession(params)
Creates a client session without rendering a UI for advanced payment flows
Creates a client session without rendering a UI. This function is used in advanced scenarios where you want to obtain a payment client token and order ID first, then handle the UI or payment flow manually.
The session is a Primer session. For Stripe checkouts, use the Billing.stripe methods.
Parameters
Section titled “Parameters”priceIdstringrequiredexternalIdstringrequiredThe customer’s external ID (your user ID).
emailstringCustomer’s email address.
orgIdstringOrganization ID, if not configured globally. Not needed if you already
called configure().
countryCodestringISO country code of the customer.
clientMetadataobjectCustom metadata attached to the order.
apiConfigobjectPer-call API settings: baseUrl and region. These override the values
from configure().
Returns
Section titled “Returns”A Promise resolving to { clientToken, orderId, type }:
clientToken: The token to use with Primer’s Headless Checkout.orderId: The order identifier in FunnelFox Payments.type: Always'session_created'.
Example
Section titled “Example”import { createClientSession } from '@funnelfox/billing';
const session = await createClientSession({ priceId: 'price_123', externalId: 'user_456', email: 'user@example.com', orgId: 'your-org-id', // Optional if configured});
console.log(session.clientToken); // Use with Primer Headless Checkoutconsole.log(session.orderId);