onPaymentOptionSelected | UI | triggered each time the payment option is selected for saved instrument both instrument details and payment method config are returned for payment method only payment method config is returned | (e: onPaymentMethodSelectedParams) => void |
onSaveInstrumentCheckboxChanged | UI | triggered each time save instrument checkbox changes state | ({ checked }: { checked: boolean }) => void; |
onPaymentButtonClicked | UI | triggered each time, user clicks on the payment button. This event is called just before the SDK makes a call to authorize. callback passed to this event should return a Promise which resolves to a boolean If this callback returns false, SDK does not make the authorize call and the user sees a payment not successful screen and also triggers onAuthorizeFailed event. | (event?: { bin?: string }) => Promise<boolean>; |
onStateChanged | UI | triggered when payment button state changes | (state: 'enabled' | 'disabled') => void; |
onThreeDSecureChallenge | Payment | triggered just before the user sees the 3ds popup | () => void; |
onPaymentSessionExpired | Payment | triggered when authorization fails due to payment session expiration | () => void; |
| onAuthorizeRequestStart | Payment | triggered only for Apple Pay and Google Pay. triggered after the user actually approves the payment on AP and GP modals and before the authorize request is initiated from the SDK. | () => void; |
onAuthorizeSuccess | Payment | triggered when payment authorization is successful callback passed to this event can pass a param to get more information regarding the authorization | (event?: any) => void; |
onAuthorizeFailed | Payment | generic authorization failure event triggered for all the authorization failure reasons. callback passed to this event can pass a param to get more information regarding the reason of failure | (event?: { code: 'AUTHORIZATION_ERROR', message: string }) => void |
onChange | UI | triggered when changes are made to the card form | (event: OnChange) => void; |
onFocus | UI | triggered when any input field inside the card form triggers focus event | () => void; |
onReady | UI | triggered when the card form is rendered and ready to pay | () => void; |
onCardChange | UI | triggered when user selects a different saved instrument in the saved instrument list | (selectedCard: StoredPaymentInstrument<CardMetadata>) => void |
onBillingAddressChanged | UI | triggered when billing address changes | ((e: { isValid: boolean; billingAddress?: IAddress; }) => void) |
onDeliveryAddressChanged | UI | triggers when shipping address changed for express flow | (((data?: onDeliveryAddressChangedResponse) => Promise<boolean>)) |
| onSuccess | Generic | triggers when Payrails Elements successfully done a payment or tokenization | (action: 'AUTHORIZE' | 'TOKENIZE', response?: any) => void; |
| onFailed | Generic | triggers when Payrails Elements failed a payment or tokenization | (action: 'AUTHORIZE' | 'TOKENIZE', e?: any) => void; |
| onPending | Generic | triggers when Payrails Elements payment or tokenization is in pending or review | (action: 'AUTHORIZE' | 'TOKENIZE', e?: any) => void; |
| onButtonClicked | Generic | • triggered each time, user clicks on the element button. • This event is called just before the SDK makes a call to either authorize or tokenize. • callback passed to this event should return a Promise which resolves to a boolean • If this callback returns false, SDK does not make the authorize / tokenize call and the user sees a payment / tokenize not successful screen and also triggers onFailed event. | (e?: { bin?: string }) => Promise<boolean>; |
| onRequestStart | Generic | • only for AP and GP. • triggered after the user actually approves the payment on AP and GP modals and before the authorize / tokenize request is initiated from the SDK. | () => Promise<boolean>; |