Skip to main content

PayNow Component API

提醒

你正在閱讀 PayNow Component v1 文件,若想觀看 v2 文件,請參考ComponentsDocs

方法

updateLocale

變更介面語系

PayNow.updateLocale('zh_tw')

checkout

提交表單

PayNow.checkout().then(response => {
if (response.error) {
// handle error
}
// handle success
})

事件監聽器

mounted

在使用者介面已掛載時觸發

PayNow.on('mounted', () => {
// handle mounted
})

localeUpdated

在語系變更時觸發

PayNow.on('localeUpdated', (locale) => {
// handle locale changed
})

update

在欄位內容變更時觸發

PayNow.on('update', (data: UpdateData) => {
// handle field updated
})

type UpdateData = {
type: string,
data: {
cardType?: string, // will return card type when field name is 'CARD_NUMBER'
isComplete: boolean,
message: string,
name: string,
status: FieldErrorStatus,
value?: string // will return the values of inputs other than card information.
}
}

enum FieldErrorStatus {
VALID = 0, // field is valid
INVALID = 1, // field is invalid in some rules
INCOMPLETE = 2 // field is required, but got empty
}

paymentMethodSelected

在付款方式變更時觸發

PayNow.on('paymentMethodSelected', (paymentMethod: PaymentMethod) => {
// handle payment method changed
})

enum PaymentMethod {
CreditCard = "CreditCard",
ATM = "ATM",
CreditCardInstallment = "CreditCardInstallment"
}