LoopConnectPayIn
component page.
Collect payment
Loop Connect’spay-in
web component renders a customizable UI for users to connect their wallet, select their token, and complete the payment authorization process.
Attributes
The following table maps the custom attributes available for theloop-connect-pay-in
web component to the cooresponding properties of the standard React component.
Attribute name | Equivalent React property |
---|---|
payment-usd-amount (required) | paymentUsdAmount |
minimum-authorization-usd-amount | minimumAuthorizationUsdAmount |
suggested-authorization-usd-amount | suggestedAuthorizationUsdAmount |
customer-ref-id | customerRefId |
subscription-ref-id | subscriptionRefId |
invoice-ref-id | invoiceRefId |
await-confirmation | awaitConfirmation |
state-notification | stateNotification |
failure-notification | failureNotification |
confirming-notification | confirmingNotification |
complete-notification | completeNotification |
authorized-notification | authorizedNotification |
custom-styles | customStyles |
disabled | disabled |
disable-submit | disableSubmit |
bill-date | billDate |
PayIn events
Theloop-connect-pay-in
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 | PayInReadyEvent |
readyfailed | onreadyfailed | PayInReadyFailedEvent |
tokenchange | ontokenchange | PayInTokenChangeEvent |
statechange | onstatechange | PayInStateChangeEvent |
authorizationupdated | onuthorizationdpdated | PayInAuthorizationUpdatedEvent |
customercreated | oncustomercreated | PayInCustomerCreatedEvent |
created | oncreated | PayInCreatedEvent |
confirmed | onconfirmed | PayInConfirmedEvent |
failure | onfailure | PayInFailedEvent |
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 “PayIn” component, adding a listener for thestatechange
event.