API Reference@flopay/js
loadFloPay
The primary entry point for initializing the FloPay client-side SDK.
loadFloPay
Loads and initializes the FloPay SDK. This is the primary entry point for consumer applications. It initializes the underlying payment provider (currently Stripe) and returns a ready-to-use FloPay instance.
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
publishableKey | string | Yes | Your FloPay/Stripe publishable key (e.g. pk_test_...). |
options | Omit<FloPayConfig, 'publishableKey'> | No | Additional configuration options. |
Options:
| Name | Type | Description |
|---|---|---|
billingApiUrl | string | Billing API base URL (e.g. https://api.stage.flopay.com). Required for retrieveSession. |
locale | string | Locale code (e.g. "en"). |
appearance | FloPayAppearance | Default appearance for all elements. |
apiVersion | string | API version header value. |
Returns
Promise<FloPay> -- a fully initialized FloPay instance.
Caching
loadFloPay caches the instance by publishable key. Calling it again with the same key returns the cached instance. Calling with a different key destroys the previous instance and creates a new one.
Errors
Throws FloPayError with type 'validation_error' if publishableKey is empty.