This page explains how to add Google Pay to your existing Components integration.
Requirements
Follow the setup instructions in the Google Pay documentation.
Select the server-side flow that your integration uses:
Requirement | Description |
---|---|
Integration type | Make sure that you have built a Flutter Components integration. |
Setup steps | Before you begin, add Google Pay in your Customer Area. |
API reference
When you make the /sessions
request, Google Pay does not require any additional fields.
Components configuration
When you create the configuration object, you must add additional properties for Google Pay.
Property | Description |
---|---|
googlePayEnvironment |
The environment for Google Pay. Possible values: - test - production |
final GooglePayConfiguration googlePayConfiguration = GooglePayConfiguration( // Change this to production to accept live payments. googlePayEnvironment: test // ... Other optional parameters.
Create a configuration object for the Google Pay Component and pass the configuration for Google Pay to it.
final GooglePayComponentConfiguration googlePayComponentConfiguration = GooglePayComponentConfiguration( // Change the environment to production to accept live payments. environment: Environment.test, clientKey: CLIENT_KEY, countryCode: COUNTRY_CODE, applePayConfiguration: applePayConfiguration shopperLocale: SHOPPER_LOCALE, // Optional. amount: AMOUNT, // Optional. );
Optional configuration
You can include the following parameters in the configuration object:
Parameter | Description |
---|---|
merchantAccount |
Your Google Merchant ID. This can be anything for testing. Before you go live, get your Google Merchant ID from the Google Pay & Wallet Console. |
merchantInfo |
The merchant name that shows on the payment form. For more information, refer to Google Pay API documentation on MerchantInfo for more details. |
totalPriceStatus |
The status of the total price. Possible values: - finalPrice: the total price shown to the shopper doesn't change. - estimated: the total price can change based on the details of the response, such as sales tax based on the billing address. notCurrentlyKnown: the total price is not known. |
allowedCardNetworks |
The list of supported card networks that you support. |
allowedAuthMethods |
The list of fields that are supported to authenticate a card transaction. Possible values: - panOnly:associated with payment cards stored on file with the user's Google Account. Returned payment data includes personal account number (PAN) with the expiration month and the expiration year. -cryptogram3DS: associated with cards stored as Android device tokens. Returned payment data includes a 3D Secure cryptogram generated on the device. |
allowPrepaidCards |
Set to true to allow prepaid cards. |
allowCreditCards |
Set to true to allow credit cards. |
assuranceDetailsRequired |
Set to true to require |
emailRequired |
Set to true to require email. |
existingPaymentMethodRequired |
Set to true to only show the payment button if a shopper can pay with a supported payment method. |
shippingAddressRequired |
Set to true to require the shipping address. |
shippingAddressParameters |
Set any shipping restrictions. |
billingAddressRequired |
Set to true to require the billing address. |
billingAddressParameters |
The expected fields returned if billingAddressRequired is set to true. For more information on the available fields, refer Google Pay API documentation on billingAddressParameters. |
You can refer to the GooglePayConfiguration
class in Github.
After adding the configuration object for Google Pay, initialize and show the Component.
Test and go live
To start testing Google Pay, log in to a Google account and create a Google Pay wallet.
There are two approaches to using this wallet for testing:
-
Enroll in test card suite
Enroll your wallet in Google's test card suite. Test card suite pre-populates your wallet with a group of cards to use in the TEST environment. These are related to Adyen's collection of test cards, and cover scenarios including:
- Cards stored as FPAN
- Cards stored as DPAN (only when testing through native Android and Chrome on Android)
- Cards enabled for 3DS2
When you start the payment flow and open the list of test cards, each card is marked with the applicable scenario.
-
Without test card suite
You upload real credit cards to your wallet, which are mapped to one of Adyen's test cards of the same brand. Your card is not charged.
To test 3D Secure 2, you must use American Express or Discover cards, which trigger 3D Secure 2 challenge flows in the test environment. You cannot use any other card brands.
You can check the status of a Google Pay test payment in your Customer Area > Transactions > Payments, whether you used a card from the test card suite or or not. Remember that cards outside the test card suite are mapped to an Adyen test card of the same brand.
For more information, see Google Pay's test environment for Android.
Before you go live
We recommend that you test the scenarios described in Google Pay’s API reference for Android in your live environment.
- Make sure that your API credential has the API Clientside Encryption Payments role. Check this in your live Customer Area or ask your Admin user to verify.
- Go to your live Customer Area to configure your Google Merchant ID.
- Complete all the steps in the Google Pay API deploy to production documentation for Android.
In the live environment, note that Google Pay will only be available if: