LoopConnectPaymentMethods
component page.
Manage payment methods
Loop Connect’spayment-methods
web component renders a customizable UI for users to manage their saved payment methods, including viewing, editing authorization amounts, adding new methods, and setting default payment methods.
Attributes
The following table maps the custom attributes available for theloop-connect-payment-methods
web component to the corresponding properties of the standard React component.
Attribute name | Equivalent React property |
---|---|
customer-id | customerId |
customer-ref-id | customerRefId |
minimum-authorization-usd-amount | minimumAuthorizationUsdAmount |
disabled | disabled |
custom-styles | customStyles |
Payment Methods events
Theloop-connect-payment-methods
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. The specification for each event type can be found documented along with the React version of this component.
Custom event | Handler attribute / property | Callback object type |
---|---|---|
ready | onready | PaymentMethodsReadyEvent |
readyfailed | onreadyfailed | PaymentMethodsReadyFailedEvent |
statechange | onstatechange | PaymentMethodsStateChangeEvent |
tokenchange | ontokenchange | PaymentMethodsTokenChangeEvent |
authorizationupdated | onauthorizationupdated | PaymentMethodsAuthorizationUpdatedEvent |
customercreated | oncustomercreated | PaymentMethodsCustomerCreatedEvent |
created | oncreated | PaymentMethodsCreatedEvent |
updated | onupdated | PaymentMethodsUpdatedEvent |
deleted | ondeleted | PaymentMethodsDeletedEvent |
failure | onfailure | PaymentMethodsFailedEvent |
walletchange
and networkchange
can also both be captured using onwalletchange
and onnetworkchange
respectively from the Web Component, in addition the handlers passed to initLoopConnect()
outlined on the initialization page.
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 “PaymentMethods” component, adding a listener for thestatechange
event.