Hosted Payment Page
redirectToCheckout(props)
Parameters
props
requiredHostPaymentPageclient_secret
requiredstringclient_secret of the Payment Intent when Payment Intent is provided. Otherwise, this should be the client_secret of the Customer object.currency
requiredstringcurrency will be shown on the payment page.allowedCardNetworks
optional('visa' | 'mastercard' | 'maestro' | 'unionpay' | 'amex' | 'jcb' | 'diners' | 'discover')[]appearance
optionalAppearancemode
optional'light' | 'dark''dark' or 'light' modes where each mode provides a different color variable preset and color generation logic.'light'variables
optionalVariablescolorBackground
optionalstring'#ffffff' (light mode) and '#14171A' (dark mode)colorBrand
optionalstring'#612fff' (light mode) and '#ABA8FF' (dark mode)colorText
optionalstring'#14171a' (light mode) and '#F5F6F7' (dark mode)applePayRequestOptions
optionalApplePayRequestOptionscountryCode
requiredstringapplicationData
optionalstringbillingContact
optionalApplePayPaymentContactaddressLines
optionalstring[]administrativeArea
optionalstringcountry
optionalstringcountryCode
optionalstringemailAddress
optionalstringfamilyName
optionalstringgivenName
optionalstringlocality
optionalstringphoneNumber
optionalstringphoneticFamilyName
optionalstringphoneticGivenName
optionalstringpostalCode
optionalstringsubAdministrativeArea
optionalstringsubLocality
optionalstring'black'Supported methods for presenting the Apple Pay button.
A translated button label may appear if a language specified in the viewer's browser matches an available language.
add-money
book
buy
check-out
continue
contribute
donate
order
pay
plain
reload
rent
set-up
subscribe
support
tip
top-up
existingPaymentMethodRequired
optionalbooleanWhether the shopper must have an active card provisioned in Apple Pay.
When set to true, the Apple Pay button will only be displayed if the user has
an active card in their Apple Pay wallet, checked via
ApplePaySession.canMakePaymentsWithActiveCard().
falselineItems
optionalApplePayLineItem[]amount
requiredstringlabel
requiredstringautomaticReloadPaymentThresholdAmount
optionalstringdeferredPaymentDate
optionalDatepaymentTiming
optional'immediate' | 'deferred' | 'recurring' | 'automaticReload'recurringPaymentEndDate
optionalDaterecurringPaymentIntervalCount
optionalnumberrecurringPaymentIntervalUnit
optional'year' | 'month' | 'day' | 'hour' | 'minute'recurringPaymentStartDate
optionalDatetype
optional'final' | 'pending'merchantCapabilities
optional('supports3DS' | 'supportsEMV' | 'supportsCredit' | 'supportsDebit')[]Payment capabilities supported by the merchant.
If not configured, merchantCapabilities will be based on merchant's account settings.
supports3DS: Required. This value must be supplied.
supportsCredit: Optional. If present, only transactions that are categorized as credit cards are allowed.
supportsDebit: Optional. If present, only transactions that are categorized as debit cards are allowed.
supportsEMV: Include this value only if you support China Union Pay transactions. (if
supportedNetworksdoes not contain chinaUnionPay, don't include it).
requiredBillingContactFields
optional'postalAddress'[]requiredShippingContactFields
optional('email' | 'name' | 'phone' | 'postalAddress' | 'phoneticName')[]shippingContact
optionalApplePayPaymentContactaddressLines
optionalstring[]administrativeArea
optionalstringcountry
optionalstringcountryCode
optionalstringemailAddress
optionalstringfamilyName
optionalstringgivenName
optionalstringlocality
optionalstringphoneNumber
optionalstringphoneticFamilyName
optionalstringphoneticGivenName
optionalstringpostalCode
optionalstringsubAdministrativeArea
optionalstringsubLocality
optionalstringshippingMethods
optionalApplePayShippingMethod[]amount
requiredstringdetail
requiredstringidentifier
requiredstringlabel
requiredstringdateComponentsRange
optionalApplePayDateComponentsRangeendDateComponents
requiredApplePayDateComponentsdays
requirednumberhours
requirednumbermonths
requirednumberyears
requirednumberstartDateComponents
requiredApplePayDateComponentsdays
requirednumberhours
requirednumbermonths
requirednumberyears
requirednumbershippingType
optional'shipping' | 'delivery' | 'storePickup' | 'servicePickup'supportedCountries
optionalstring[]supportedNetworks
optionalstring[]Card networks supported by the merchant.
If not configured, supportedNetworks will be based on merchant's account settings.
For more details, see https://developer.apple.com/documentation/apple_pay_on_the_web/applepaypaymentrequest/1916122-supportednetworks
totalPriceLabel
optionalstringtotalPriceType
optional'pending' | 'final'Indicate whether a line item is final or pending.
If the mode is recurring and if it's a variable subscription, the value should be pending.
'final'The authorization type for the card payment.
Set it to 'pre_auth' if you want to place a hold on your customer’s card for more than 7 days, i.e., extend the authorization time window.
Currently 'pre_auth' is only available when the card brand is Visa or Mastercard. autoCapture will be automatically set to false if you enable 'pre_auth'.
'final_auth'autoCapture
optionalbooleanWhether the amount should be captured automatically upon successful payment authorization.
Set it to false if you want to place a hold on the payment method and capture the funds sometime later.
trueautoSaveCardForFuturePayments
optionalbooleanSpecifies whether the card payment method should be automatically saved for future transactions.
This parameter is only effective in payment mode when a customer_id is provided.
- If set to
true, the "Save my card for future payments" checkbox will be preselected by default. - If set to
false, the checkbox will remain unchecked, requiring the shopper to manually opt in.
truecancelUrl
optionalstringThe HTTPS URL to redirect shoppers when they choose to go back or cancel the payment. When provided, a back button will be displayed on the Hosted Payment Page allowing the shopper to return to the merchant's site. If not provided, no back button will be shown.
country_code
optionalstringThe two-letter ISO country code of the shopper's country. If the country_code is not provided, we will determine it based on the shopper's IP address. However, some payment methods, such as iDEAL, are only available to shoppers in specific countries. If the shopper is not located in a supported country, the corresponding payment method may not be displayed. To ensure that your customers can successfully complete their payments using the appropriate methods, we strongly recommend that you explicitly pass the country_code to us.
customer_id
optionalstringThe ID of the Customer used in registered user checkout. Refer to Airwallex Client API
This field is required when mode is 'recurring'.
cvcRequired
optionalbooleandisableAutoRedirect
optionalbooleanfalseenv
optional'demo' | 'prod'prodgooglePayRequestOptions
optionalGooglePayHppRequestOptionscountryCode
requiredstringallowCreditCards
optionalbooleantrueallowedAuthMethods
optionalCardAuthMethod[]['PAN_ONLY', 'CRYPTOGRAM_3DS']allowedCardNetworks
optional('MASTERCARD' | 'MAESTRO' | 'VISA' | 'AMEX' | 'DISCOVER' | 'JCB')[]allowPrepaidCards
optionalbooleantrueassuranceDetailsRequired
optionalbooleantrue if you need information about the validation performed on the returned payment data.falsebillingAddressParameters
optionalBillingAddressParametersbillingAddressRequired
optionalbooleanfalse'default'default
black
white
Determines how the button's size should change relative to the button's parent element.
'static'static
fill
book
buy
checkout
donate
order
pay
plain
subscribe
long
short
callbackIntents
optionalCallbackIntent[]List of callbacks that the developer intents to handle.
Upon selection by the shopper, these intents can be used to update the
request with new data based on that selection (For exmaple, if a shipping
option is selected, the developer could update the transactionInfo
with new totalPrice and diplayItems).
checkoutOption
optionalCheckoutOptiondisplayItems
optionalDisplayItem[]emailRequired
optionalbooleanfalseexistingPaymentMethodRequired
optionalbooleanfalsegatewayMerchantId
optionalstringmerchantInfo
optionalobjectmerchantName
optionalstringmerchantOrigin
optionalstringofferInfo
optionalOfferInfoOffers available for redemption that can be used with the current order.
offers
requiredOfferDetail[]description
requiredstringDescription for the offer visible to the user to inform them about the offer. The description is displayed in buyflow and should be less than 60 characters long.
redemptionCode
requiredstringRedemption code available for this transaction. This is used to identify the offer when the user decides to apply the offer.
paymentDataCallbacks
optionalPaymentDataCallbacksDefines callback methods for handling changed payment data and payment authorized events.
shippingAddressParameters
optionalShippingAddressParametersallowedCountryCodes
optionalstring[]Allowed country codes for the shipping address.
This list should be an array of ISO 3166-1 alpha-2 country codes
(e.g., ["US", "CA", "JP"]).
If omitted, a shipping address from any supported country may be returned.
phoneNumberRequired
optionalbooleanWhether a phone number is additionally required from the buyer for the shipping address (the phone number will only be returned if an address is required, otherwise this field has no effect).
If omitted, defaults to false.
shippingAddressRequired
optionalbooleanfalseshippingOptionParameters
optionalShippingOptionParametersParameters for shipping option that can be used in this request. Note: This field is currently for web only.
shippingOptions
requiredSelectionOption[]All the shipping options available for the current request. Will be rendered in the UI with given order.
This field is required.
id
requiredstringA unique identifier for the option.
This field is required.
label
requiredstringThe label to be displayed as the option.
This field is required.
description
optionalstringA descriptive text that will be displayed below option label.
This field is optional.
defaultSelectedOptionId
optionalstringIdentifier to the default selected shipping option. If this field is not provided the first option will be the default option.
This field is optional.
shippingOptionRequired
optionalbooleanWhether a shipping option is required from the shopper.
Note: This field is currently for web only.
falsetotalPriceLabel
optionalstringTotal price label of this transaction. The string will be shown as the total price label on the cart modal dialog page. This field is optional, but required if developer wants to show cart information. Otherwise the cart modal dialog will not be rendered.
totalPriceStatus
optionalenumThe status of the total price. If it is a variable subscription, the status should be NOT_CURRENTLY_KNOWN.
'FINAL'NOT_CURRENTLY_KNOWN
ESTIMATED
FINAL
transactionId
optionalstringCorrelation ID to refer to this transaction.
This field is optional. It is generated by the merchant and used to reference this transaction later, such as for debugging issues when communicating with Google.
intent_id
optionalstringmode is 'payment'.layout
optionalHppLayouttype
optional'tab' | 'accordion'accordion layout is used on desktop and tab layout is used on mobile.locale
optionalenumar
da
de
en
es
fi
fr
he
id
it
ja
ko
ms
nl
pl
pt
ro
ru
si
sv
tr
vi
ur
zh
zh-HK
logoUrl
optionalstringmethods
optionalenum[]googlepay
applepay
card
airwallex_pay
alipaycn
alipayhk
gcash
dana
kakaopay
tng
rabbit_line_pay
poli
fpx
online_banking
bank_transfer
permatanet
alfamart
indomaret
doku_ewallet
enets
payeasy
seven_eleven
konbini
tesco_lotus
grabpay
skrill
eps
giropay
ideal
multibanco
p24
sofort
trustly
bancontact
dragonpay
blik
mybank
paybybankapp
verkkopankki
maxima
narvesen
paypost
perlas_terminals
paysafecash
paysafecard
paysera
satispay
family_mart
hi_life
sam_kiosk
axs_kiosk
bigc
esun
permata_atm
boost
shopee_pay
paypal
payu
ovo
bitpay
truemoney
atome
duit_now
pay_now
prompt_pay
go_pay
linkaja
jenius_pay
klarna
wero
korean_local_card
naver_pay
payco
samsung_pay
au_pay
bkash
d_barai
line_pay
merpay
payeasy_atm
paypay
rakuten_pay
safetypay
toss_pay
upi
zip
spei
afterpay
cash_app_pay
twint
laybuy
venmo
payme
tabby
octopus
spaylater
wechatpay
fps
pix
jkopay
ach_direct_debit
bacs_direct_debit
becs_direct_debit
sepa_direct_debit
eft_direct_debit
mode
optional'payment' | 'recurring''payment'payment_consent
optionalPaymentConsentOptionsnext_triggered_by
required'merchant' | 'customer'merchant_trigger_reason
optional'scheduled' | 'unscheduled' | 'installments''unscheduled'terms_of_use
optionalTermsOfUsepayment_amount_type
required'FIXED' | 'VARIABLE'payment_currency
requiredstringstart_date
requiredstringbilling_cycle_charge_day
optionalnumberThe granularity per billing cycle. Required when payment_schedule.period_unit is WEEK, MONTH, or YEAR.
end_date
optionalstringfirst_payment_amount
optionalnumberThe first payment. It could include the costs associated with the first debited amount. Optional if payment_amount_type is VARIABLE.
fixed_payment_amount
optionalnumberThe fixed payment amount that can be charged for a single payment. Required if payment_amount_type is FIXED.
max_payment_amount
optionalnumberThe maximum payment amount that can be charged for a single payment. Optional if payment_amount_type is VARIABLE.
payment_schedule
optionalobjectperiod
requirednumberThe number of period units between billing cycles. For example, the payment cycle is one month if period=1 and period_unit=MONTH. Required when merchant_trigger_reason = scheduled.
period_unit
required'DAY' | 'WEEK' | 'MONTH' | 'YEAR'Specifies billing frequency. One of DAY, WEEK, MONTH, and YEAR. Required when merchant_trigger_reason = scheduled.
total_billing_cycles
optionalnumberThe total number of billing cycles of the payment schedule. If null, the mandate will continue indefinitely.
platformConnectedAccount
optionalstringWhen using Payments for Platforms, specify the ID of the connected account associated with the payment if you want to use its information to process the payment. For example, the statement descriptor displayed on the shopper's credit card or bank statement and the payment methods activated by the connected account.
recurringOptions
optionalRecurringOptionsconnected_account_id
optionalstringThe ID of the connected account linked to the platform. The platform should indicate the connected entity in the transaction only when platform is the owner of the transaction.
currency
optionalstringdescriptor
optionalstringmerchant_trigger_reason
optional'scheduled' | 'unscheduled''scheduled' or 'unscheduled'. Only applicable when next_triggered_by is 'merchant'.'unscheduled'next_triggered_by
optional'merchant' | 'customer''customer'three_ds_action
optional'SKIP_3DS' | 'FORCE_3DS'Set it to SKIP_3DS if you want to skip 3DS regardless of the risk score and Strong Customer Authentication (SCA) regulation. Only applicable when it's a card recurring flow.
Set it to FORCE_3DS if you want to force 3DS regardless of the risk score and Strong Customer Authentication (SCA) regulation. Only applicable when it's a card recurring flow.
requiredBillingContactFields
optional('name' | 'email' | 'country_code' | 'address' | 'phone')[]savedPaymentMethod
optionalSavedPaymentMethodOptions{ displayMode: 'auto', saveMode: 'auto' }displayMode
optional'auto' | 'never'Controls if UI displays existing saved payment methods.
- 'auto' (default): If we have customer_id + valid payment consents, fetch and show saved methods (current behavior).
- 'never': Never show saved methods in the UI, even if they exist.
Note: This only affects display. Whether we store a method is controlled by saveMode.
'auto'shopper_email
optionalstringshopper_name
optionalstringshopper_phone
optionalstringshowTermLink
optionalbooleansubmitType
optional'pay' | 'book' | 'subscribe' | 'save'Describes the type of transaction being performed in order to customize the submit button text.
Available options are 'pay', 'book', 'subscribe', 'save'.
If blank, the default value will be 'pay'
'pay'successUrl
optionalstringwechatpay
optionalWeChatPayFlowdesktopFlow
optional'webqr' | 'mweb' | 'jsapi' | 'inapp'mobileFlow
optional'webqr' | 'mweb' | 'jsapi' | 'inapp'components
optionalenum[]Deprecatedgooglepay
applepay
card
airwallex_pay
alipaycn
alipayhk
gcash
dana
kakaopay
tng
rabbit_line_pay
poli
fpx
online_banking
bank_transfer
permatanet
alfamart
indomaret
doku_ewallet
enets
payeasy
seven_eleven
konbini
tesco_lotus
grabpay
skrill
eps
giropay
ideal
multibanco
p24
sofort
trustly
bancontact
dragonpay
blik
mybank
paybybankapp
verkkopankki
maxima
narvesen
paypost
perlas_terminals
paysafecash
paysafecard
paysera
satispay
family_mart
hi_life
sam_kiosk
axs_kiosk
bigc
esun
permata_atm
boost
shopee_pay
paypal
payu
ovo
bitpay
truemoney
atome
duit_now
pay_now
prompt_pay
go_pay
linkaja
jenius_pay
klarna
wero
korean_local_card
naver_pay
payco
samsung_pay
au_pay
bkash
d_barai
line_pay
merpay
payeasy_atm
paypay
rakuten_pay
safetypay
toss_pay
upi
zip
spei
afterpay
cash_app_pay
twint
laybuy
venmo
payme
tabby
octopus
spaylater
wechatpay
fps
pix
jkopay
ach_direct_debit
bacs_direct_debit
becs_direct_debit
sepa_direct_debit
eft_direct_debit
failUrl
optionalstringDeprecatedThe HTTPS URL to redirect shoppers when payment fails. We do not recommend merchants to pass this value. If a payment fails, shoppers should retry the payment or switch to a different payment method instead of redirecting to a failure URL.
theme
optionalHppThemeDeprecatedbase
optionalCSSPropertiesfonts
optionalFontOptions[]family
optionalstringThe font-family property, for example, AxLLCircular.
https://developer.mozilla.org/en-US/docs/Web/CSS/font-family
src
optionalstringThe font-source property, for example, https://checkout.airwallex.com/fonts/CircularXXWeb/CircularXXWeb-Regular.woff2.
https://developer.mozilla.org/en-US/docs/Web/CSS/@font-face
weight
optionalstring | numberThe font-weight property. Supported font weights include: regular (400) and bold (700). https://developer.mozilla.org/en-US/docs/Web/CSS/font-weight
input
optionalCSSProperties & PseudoClassStylepopupHeight
optionalnumberpopupWidth
optionalnumbervariant
optional'standard' | 'outlined' | 'filled' | 'bootstrap'withBilling
optionalbooleanDeprecatedUsed to increase the likelihood of 3DS frictionless checkout.
Set this to true if you want the payment form to collect billing information from the shopper. Only applies to card payment method.
Returns
void | string
1import { init } from '@airwallex/components-sdk';23const { payments } = await init({4 env: 'demo', // Choose the Airwallex environment ('demo' or 'prod')5 enabledElements: ['payments'],6});7payments.redirectToCheckout({8 intent_id: 'replace-with-your-intent-id',9 client_secret: 'replace-with-your-client-secret',10 currency: 'replace-with-your-currency',11 country_code: 'replace-with-your-country-code',12});