Listeners
Event listeners that can be registered using on
within the PayNow
instance.
mounted
Usage
ts
PayNow.on('mounted', () => {
// handler callback
})
paymentMethodSelected
Usage
ts
PayNow.on('paymentMethodSelected', (paymentMethod: PaymentMethodsEnum) => {
// handler callback
})
Type declarations
ts
type PaymentMethodsEnum = 'CreditCard' | 'CreditCardInstallment' | 'ATM' | 'ApplePay' | 'ConvenienceStore'
localeUpdated
Usage
ts
PayNow.on('localeUpdated', (locale: LocaleEnum) => {
// handler callback
})
Type declarations
ts
type LocaleEnum = 'zh_tw' | 'en' | 'ja' | 'zh_cn'
update
Usage
ts
PayNow.on('update', (data: UpdateData) => {
// handler callback
})
Type declarations
ts
type UpdateData = {
/**
* will return card type when field name is 'CARD_NUMBER', e.g., 'visa'
*/
cardType?: CardType,
/**
* field value is valid
*/
isComplete: boolean,
/**
* error message if status is invalid, e.g., 'Invalid card number'
*/
message: string,
/**
* field name, e.g., 'CARD_NUMBER'
*/
name: FieldName,
status: FieldErrorStatus,
/**
* will return the values of inputs other than card information.
*/
value?: string
}
type CardType = 'amex' | 'mastercard' | 'visa' | 'diners' | 'discover' | 'jcb' | 'dankort' | 'instapayment' | 'uatp' | 'mir' | 'unionPay'
type FieldName =
'FIRST_NAME' | 'LAST_NAME' | 'EMAIL' | 'COUNTRY' | 'PHONE_CODE' | 'PHONE_NUMBER' |
'CARD_NUMBER' | 'CARD_EXPIRATION' | 'CARD_CSC' | 'INSTALLMENT' | 'CODE_TYPE'
enum FieldErrorStatus {
/**
* field is valid
*/
VALID = 0,
/**
* field is invalid in some rules
*/
INVALID = 1,
/**
* field is required, but got empty
*/
INCOMPLETE = 2
}