Airwallex logo
Airwallex logo

Hosted Payment Page

If you are using Hosted Payment Page integration option then you need to enable your account for Google Pay™ on the Airwallex web app. For details, see Enable Google Pay

You are not required to complete integration and registration formalities with Google for the Hosted Payment Page integration.

Integration steps

  1. Create a PaymentIntent Create a PaymentIntent API using the Airwallex API.

  2. Integrate Hosted Payment Page JS

  3. Configure Google Pay Include the googlePayRequestOptions JS object when calling the Airwallex redirectToCheckout method. Note that the countryCode is the only required field in googlePayRequestOptions. You can also include additional information to configure the button style or provide information on payment processing capabilities.

Example request

JavaScript
1import { init } from '@airwallex/components-sdk';
2
3const { payment } = await init({
4 env: 'demo', // Choose the Airwallex environment ('demo' or 'prod')
5 enabledElements: ['payments'],
6});
7payment.redirectToCheckout({
8 intent_id: 'replace-with-your-intent-id',
9 client_secret: 'replace-with-your-client-secret',
10 currency: 'replace-with-your-currency',
11 googlePayRequestOptions: {
12 countryCode: "US",
13 merchantInfo: {
14 merchantName: "Example Merchant",
15 },
16 emailRequired: true,
17 billingAddressParameters: {
18 format: 'FULL',
19 phoneNumberRequired: true
20 },
21 billingAddressRequired: true,
22 buttonType: "book",
23 buttonColor: "black",
24 buttonSizeMode: "fill"
25 }
26});

Subscription payments

You can use Google Pay payment method to setup recurring payments on your website. Our API enables clients to provide clear information about the recurring contract terms which makes it easy for consumers to checkout with ease.

This documentation is limited to subsequent Merchant initiated transactions, subsequent Consumer Initiated Transaction is not considered since Google Pay is a digital wallet and already uses saved credentials to process payments.

Save details with deferred payment

  1. You need to follow the steps as described in registered checkout

  2. Configure Google Pay to include information about the order items, charge & contract details, these details will be displayed on the paymentsheet shown to customer.

JSON
1 redirectToCheckout({
2 env: getAirwallexEnv(),
3 client_secret: 'Your client secret id',
4 currency: 'USD',
5 customer_id: 'your customer id',
6 mode: 'recurring',
7 ...
8 googlePayRequestOptions: {
9 countryCode: 'US',
10 displayItems:[{
11 label: "monthly"
12 price: "1"
13 status: "FINAL"
14 type: "LINE_ITEM"
15 }],
16 }
17 });

Save details with payment

  1. You need to follow the steps as described in the documentation. Sample code is as below
JSON
1redirectToCheckout({
2 env: getAirwallexEnv(),
3 intent_id: data?.id,
4 client_secret: 'your client secret',
5 currency: 'USD',
6 customer_id: 'your customer id',
7 mode: 'recurring',
8 ...
9 googlePayRequestOptions: {
10 countryCode: 'US',
11 displayItems:[{
12 label: "monthly"
13 price: "1"
14 status: "FINAL"
15 type: "LINE_ITEM"
16 }],
17 }
18 });
Was this page helpful?