Skip to main content
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 possibly handle the UI or payment flow manually.

Parameters

priceId
string
required
The price identifier for the subscription/product.
externalId
string
required
The customer’s external ID (your user ID).
email
string
required
Customer’s email address.
orgId
string
Organization ID, if not configured globally. Not needed if you already called configure().

Returns

A Promise resolving to an object containing at least { clientToken, orderId, type }. The clientToken can be used with Primer’s checkout, and orderId is the generated order identifier on Funnelfox’s side.

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 SDK
console.log(session.orderId);
I