Because the PaymentUIComponents
exist inside an elements.io hosted iframe, the only way to communicate with your PaymentUIComponents
is by listening to an event. PaymentUIComponents
might emit any of the events below. All events have a payload object that has an elementType property with the type of the PaymentUIComponents
that emitted the event.
cardComponent.on('change', function(event) {
// handle event here
});
{
brand: ‘visa’,
componentType: ‘card’,
empty: false,
valid: true,
potentiallyValid: true
}
Method Parameters
on(eventName, handler)
This method registers the handler with the given eventName. The handler will be triggered when the corresponding event is emitted.
Method parameters
Name | Description |
---|---|
eventName (string) | The name of the event. can be any of: |
handler: (event) => void | the callback function that you provide will be called when the event is fired. When called it will be passed an event object with the following properties:
|