FloPayFloPay
API Reference@flopay/js

FloPay Class

The main FloPay SDK instance providing hosted card capture, provider access, and session retrieval.

FloPay

The main FloPay SDK instance. Created via loadFloPay(publishableKey).

class FloPay {
  constructor(provider: PaymentProviderAdapter, config: FloPayConfig)
}

cardCapture

Creates a hosted vault card-capture adapter. The backend-rendered widget owns card tokenization, the PaymentIntent, 3DS, and fulfilment; PCI-sensitive fields do not enter the SDK runtime.

cardCapture(options?: {
  sessionId?: string;
  captureMethod?: CaptureMethod;
}): CardCaptureAdapter
ParameterTypeRequiredDescription
options.sessionIdstringNoCheckout session ID used to correlate the capture outcome.
options.captureMethodCaptureMethodNoCapture behavior used to classify legacy vault outcomes safely.

Returns: CardCaptureAdapter


retrieveSession

Retrieves a checkout session by ID via the billing API. Returns the normalized CheckoutSession.

async retrieveSession(
  sessionId: string,
  billingApiUrl?: string
): Promise<CheckoutSession>
ParameterTypeRequiredDescription
sessionIdstringYesCheckout session UUID.
billingApiUrlstringNoBilling API URL. Falls back to the URL set in loadFloPay().

Returns: Promise<CheckoutSession>

Throws: FloPayError if sessionId or billingApiUrl is missing, or if the session is not found.

const session = await flopay.retrieveSession('uuid-xxx');
console.log(session.amount, session.currency);

retrieveUnifiedSession

Retrieves and normalizes a checkout session, including provider-specific data (Stripe clientSecret/publishableKey, Chargebee site, etc.).

async retrieveUnifiedSession(
  sessionId: string,
  billingApiUrl?: string
): Promise<NormalizedCheckoutSession>
ParameterTypeRequiredDescription
sessionIdstringYesCheckout session UUID.
billingApiUrlstringNoBilling API URL. Falls back to the URL set in loadFloPay().

Returns: Promise<NormalizedCheckoutSession>


getRawProvider

Returns the raw underlying provider instance (e.g. the Stripe object). Used by components that need direct provider access.

getRawProvider(): unknown

Returns: unknown -- the raw provider instance.


destroy

Tears down the SDK instance and releases telemetry and provider resources.

destroy(): void

On this page