API Reference@flopay/react
Hooks
React hooks for accessing FloPay SDK instances and checkout state.
useFloPay
Returns the current FloPay instance, or null if the provider is still loading (i.e. the loadFloPay() promise has not resolved yet).
Must be called within a <FloPayProvider>.
Returns: FloPay | null
useElements
Returns the current FloPayElements instance, or null if the provider is still loading.
Must be called within a <FloPayProvider>.
Returns: FloPayElements | null
useCheckout
Returns the current checkout session state. Must be called within a <CheckoutProvider> (typically rendered internally by <CheckoutForm>).
CheckoutState
| Property | Type | Description |
|---|---|---|
session | CheckoutSession | null | The current checkout session, or null if not yet loaded. |
loading | boolean | Whether the session is being fetched. |
error | FloPayError | null | Error that occurred during session retrieval. |
Returns: CheckoutState