CheckoutInstance represents an active checkout session. It is returned
from createCheckout() and provides properties,
events, and methods to manage the checkout lifecycle.
Properties
string
Unique identifier for this checkout session.
string | null
The order identifier associated with the checkout (available once
initialization completes).
boolean
Whether this checkout instance has been destroyed (i.e., cleaned up).
States
Methods
Once you have aCheckoutInstance, you can control or query it with the
following methods.
updatePrice(priceId)
Switch the checkout to a different price point without reloading the page.string
required
The new price point identifier.
updating and the payment buttons are
disabled. When the update finishes, the state returns to ready. If
FunnelFox Payments Taxes is on, the SDK then recalculates tax and calls
onTaxPending and onTaxChange.
- Payment in progress: A
CheckoutErrorwhen the state isprocessing. - Destroyed checkout: A
CheckoutErrorafterdestroy(). - Empty price: A
ValidationErrorwhenpriceIdis empty. - Update failed: The API error. The state changes to
errorand the'error'event fires.
getStatus()
Retrieve the current status and details of the checkout session. Returns:id: Checkout IDstate: Current stateorderId: Order ID (if initialized)priceId: Current price point IDisDestroyed: Whether the instance has been destroyed
destroy()
Destroy the checkout instance, clean up the embedded UI, and release resources. The instance emits a'destroy' event, removes all listeners, and
can no longer be used.
isReady()
Returnstrue if the checkout is in the ready state and not destroyed. Use
this to check if calling updatePrice() or allowing user input is safe.
isProcessing()
Returnstrue while a payment is in progress: in the processing or
action_required state. Use it to block actions such as starting another
checkout mid-payment.
isInState(state)
Returnstrue if the checkout is in the given state.
getContainer()
Returns the container element, ornull if it’s no longer on the page.
on(), once(), and off()
Subscribe to checkout events:on(eventName, handler): Callhandlerevery time the event fires.once(eventName, handler): Callhandlerthe next time the event fires, then remove it.off(eventName, handler): Removehandler. Leave outhandlerto remove every handler for the event.
Events
ACheckoutInstance emits these events:
success: The payment succeeded.error: Initialization or a price update failed.status-change: The state changed.destroy: The checkout was destroyed.purchase-failure: A payment attempt failed.
