Google Pay
This guide describes how to add Google Pay to your Airwallex Android SDK integration.
In addition to this, please refer additional material
When setting up your Google registration, use the following Airwallex details when you are requested to provide your gateway information to tokenize card details:
gateway : airwallex gatewayMerchantId : Your merchant name as registered with Airwallex
Step 1 : Install Google Pay component
SDK components are available through Maven Central, you only need to add the Gradle dependency.
To install the SDK, in your app-level build.gradle, add the following:
Step 2 : Configure the SDK
We provide GooglePay parameter that can be used to debug the SDK, you can call it in Application. Please refer sample code below:
Step 3 : Setup Google Pay on SDK
As a merchant you need to complete the registration with Google following the integration guidelines . Request production access to use Google Pay API once the integration checklist is complete.
Note : Do not fill information under direct integration section on Google Pay API business console , this is not required since Airwallex manages this on your behalf.
Configure your SDK with required options to process Google Pay transactions. Refer code sample below:
( allowedCardAuthMethods = listOf("CRYPTOGRAM_3DS") billingAddressParameters = BillingAddressParameters(BillingAddressParameters.Format.FULL), shippingAddressParameters = ShippingAddressParameters(listOf("AU", "CN"), true) ) val paymentSession = AirwallexPaymentSession.Builder ( paymentIntent = ..., countryCode = ..., googlePayOptions = googlePayOptions )
Step 4: Create a PaymentIntent
Your client app will need a PaymentIntent to form a payment session for Airwallex SDK to present a payment flow.
From your server, access Airwallex API to Create a PaymentIntent API and pass the returned PaymentIntent to the client app.
Step 5: Present the payment sheet to shopper
Present the payment sheet to the shopper, Use presentPaymentFlow to complete the payment, you need to pass in a AirwallexSession object.
Step 6 : obtain the payment result
To obtain the payment result, you can use the retrievePaymentIntent method and check the latest status. Then you can prompt the shopper with the result.
Customise googlePay options
You can customize the Google Pay options to restrict as well as provide extra context. For more information, please refer to GooglePayOptions class below:
You can also overwrite color values in your app, refer link for more details.