LoopConnectCheckoutSession
component page.
Usage
Attributes
The following table maps the custom attributes available for theloop-connect-checkout-session
web component to the corresponding properties of the standard React component.
Attribute name | Equivalent React property |
---|---|
state-notification | stateNotification |
failure-notification | failureNotification |
confirming-notification | confirmingNotification |
complete-notification | completeNotification |
notification-email-fallback | notificationEmailFallback |
disabled | disabled |
custom-styles | customStyles |
Checkout session events
Theloop-connect-checkout-session
component also allows optional event callback handlers to be configured, just as the React component does. The callback functions take the form ({ detail: EventType }) => void
, where detail
is within the CustomEvent
callback object. Here, EventType
is used as a placeholder to represent the individually defined type for each event.
Custom event | Handler attribute / property | Callback object type |
---|---|---|
ready | onready | CheckoutSessionReadyEvent |
readyfailed | onreadyfailed | CheckoutSessionReadyFailedEvent |
tokenchange | ontokenchange | CheckoutSessionTokenChangeEvent |
statechange | onstatechange | CheckoutSessionStateChangeEvent |
authorizationconfirmed | onauthorizationconfirmed | CheckoutSessionAuthorizationConfirmedEvent |
authorizationupdated | onauthorizationupdated | CheckoutSessionAuthorizationUpdatedEvent |
created | oncreated | CheckoutSessionCreatedEvent |
confirmed | onconfirmed | CheckoutSessionConfirmedEvent |
failure | onfailure | CheckoutSessionFailedEvent |
Custom event listener
Listen to the component for custom events by selecting the element and calling its nativeaddEventListener
method to attach a listener that executes and receives a data object when the event has been triggered.
Event handler property
As in standard in Javascript, event handlers can be assigned directly to the selected element’s event handler properties.Event handler attribute
Likewise, an event handler function can be assigned to the component in HTML using an event handler attribute without the need to select the component.Quickstart examples
Below are a few examples in common JS frameworks that implement the “CheckoutSession” component, adding a listener for thestatechange
event.