createCheckout
for the same events.
Learn more about CheckoutInstance.
success
When it fires: When a payment is completed successfully and the checkout has finished. This usually means the customer’s payment was processed and a subscription or purchase was created. Data: The event handler receives aPaymentResult
object which includes details about the completed transaction.
The ID of the order/subscription created on Funnelfox.
The status string (e.g.
"succeeded"
for a successful payment).The transaction identifier (if applicable, e.g. from the payment processor).
error
When it fires: When an error occurs during the checkout or the payment fails. Data: The handler receives anError
object (which could be one of the SDK’s specific error types like ValidationError
, APIError
, etc.). You can inspect error.message
for a human-readable message. Depending on the error type, other properties may be available:
A human-readable error message.
A short error code string, if provided (e.g.
"invalid_price"
).An ID for the request/transaction, useful when contacting support.
status-change
When it fires: Whenever the checkout’s internal state changes. For example, the checkout might move from"initializing"
to "ready"
once it’s fully loaded, then to "processing"
when the user submits payment, and finally to "completed"
or "error"
.
Data: The handler is called with two arguments: newState
and oldState
(both strings). States include "initializing"
, "ready"
, "processing"
, "action_required"
, "completed"
, and "error"
.
Example:
destroy
When it fires: When the checkout instance has been destroyed. This can happen if you callcheckout.destroy()
or if the checkout cleans up after completion.
Data: No additional data (the handler is simply called with no arguments).
Example: