FloPayElements
Manages the creation and lifecycle of payment elements in the @flopay/js SDK.
FloPayElements
Manages the creation and lifecycle of payment elements. Each FloPayElements instance is bound to a single provider adapter and tracks all created elements for cleanup.
Typically created via flopay.elements() rather than instantiated directly.
create
Creates a new element of the given type. If an element of that type already exists in the provider, it is reused. Otherwise, any existing element of that type is destroyed first.
| Parameter | Type | Required | Description |
|---|---|---|---|
type | ElementType | Yes | The element type ('payment', 'card', 'cardNumber', 'cardExpiry', 'cardCvc', 'address'). |
options | ElementOptions | No | Configuration options merged with the base options from the constructor. |
Returns: Promise<MountedElement>
getElement
Returns a previously created element by type, or null if not yet created.
| Parameter | Type | Required | Description |
|---|---|---|---|
type | ElementType | Yes | The element type to look up. |
Returns: MountedElement | null
submit
Submits all mounted elements for validation. This does NOT confirm the payment -- call flopay.confirmPayment() for that.
Returns: Promise<{ error?: FloPayError }>
destroy
Destroys all created elements and clears the internal map.