Embed events
Embed accepts an onEvent
parameter that can be used to listen to certain
events emitted from the form.
Embed emits the following events:
argumentError
Returned when the initial input (element
, options
) are incorrectly formatted or missing.
optionsLoaded
Returned when options are loaded. Stored options include the id
.
formUpdate
Returned when the form updates. Currently this only informs the developer if the form is valid.
transactionCreated
Returns a full transaction object when Gr4vy accepted the transaction,
regardless of its status. Be aware that this can be a pending or declined
transaction. To track API failures please use the transactionFailed
event.
transactionCancelled
Returned when a buyer has explicitly canceled a transaction, e.g. closing a popup or dismissing Apple Pay. This is currently not supported for 3-D Secure transactions and should not be conflated with transaction being declined or an error occurring.
transactionFailed
Returned when an API call fails to create a transaction due to a client or
server error. In other words, this event is raised when incorrect data (like an
invalid JWT) is passed to the Gr4vy API and a HTTP status code in the 4XX
or
5XX
range is returned.
To catch failed or declined transactions due to
downstream issues with the payment service, please subscribe to the
transactionCreated
event.
apiError
Returned when the form encounters an API error.
Was this page helpful?