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| Parameter | Type | Required | Description |
|---|---|---|---|
options.sessionId | string | No | Checkout session ID used to correlate the capture outcome. |
options.captureMethod | CaptureMethod | No | Capture 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>| Parameter | Type | Required | Description |
|---|---|---|---|
sessionId | string | Yes | Checkout session UUID. |
billingApiUrl | string | No | Billing 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>| Parameter | Type | Required | Description |
|---|---|---|---|
sessionId | string | Yes | Checkout session UUID. |
billingApiUrl | string | No | Billing 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(): unknownReturns: unknown -- the raw provider instance.
destroy
Tears down the SDK instance and releases telemetry and provider resources.
destroy(): void