Google Pay enables customers to use the cards they have stored with Google to make quick, easy purchases on merchant websites or in-app. Customers can use the details they store on other Google applications such as Play Store, YouTube, and Chrome web browser.
This guide focuses on integrating Google Pay directly using our XML API. You'll learn how to obtain the Google Pay token, including complying with 3D Secure authentication standards, as well as how to process an authorization
To offer Google Pay from your website or in-app, refer to the Google Pay API website for the integration steps. To integrate with our platform, specific parameters must be passed in the PaymentData request to Google.
When you submit a payment data request to the Google API, be sure to include the following parameters:
'gateway': 'globalpayments''gatewayMerchantId': ''Google Pay on the web may expose the Funding PAN (FPAN) depending on the parameters passed from the Google Pay API. Google provides two options through the allowedAuthMethods object:
Website example
{
'type': 'CARD',
'parameters': {
'allowedAuthMethods': ['PAN_ONLY', 'CRYPTOGRAM_3DS'],
'allowedCardNetworks': ['AMEX', 'DISCOVER', 'JCB', 'MASTERCARD', 'VISA']
},
'tokenizationSpecification': {
'type': 'PAYMENT_GATEWAY',
'parameters': {
'gateway': 'globalpayments',
'gatewayMerchantId': '<YOUR_MERCHANT_ID>'
}
}
}Extract the payload
In-app example
private PaymentDataRequest createPaymentDataRequest() {
PaymentDataRequest.Builder request =
PaymentDataRequest.newBuilder()
.setTransactionInfo(
TransactionInfo.newBuilder()
.setTotalPriceStatus(WalletConstants.TOTAL_PRICE_STATUS_FINAL)
.setTotalPrice("10.00")
.setCurrencyCode("USD")
.build())
.addAllowedPaymentMethod(WalletConstants.PAYMENT_METHOD_CARD)
.addAllowedPaymentMethod(WalletConstants.PAYMENT_METHOD_TOKENIZED_CARD)
.setCardRequirements(
CardRequirements.newBuilder()
.addAllowedCardNetworks(
Arrays.asList(
WalletConstants.CARD_NETWORK_VISA,
WalletConstants.CARD_NETWORK_MASTERCARD))
.build());
PaymentMethodTokenizationParameters params =
PaymentMethodTokenizationParameters.newBuilder()
.setPaymentMethodTokenizationType(
WalletConstants.PAYMENT_METHOD_TOKENIZATION_TYPE_PAYMENT_GATEWAY)
.addParameter("gateway", "globalpayments")
.addParameter("<YOUR_MERCHANT_ID>", "")
.build();
request.setPaymentMethodTokenizationParameters(params);
return request.build();
}Google will respond with the PaymentData response, which includes the encrypted payload (token). They provide two environments: ENVIRONMENT_TEST and ENVIRONMENT_PRODUCTION. You can process either token type on our platform. You must contact Google before being able to process Production tokens. For more information, see the Google Pay website.
Using the Auth-Mobile request type, include the token obtained from the device instead of the standard card details captured from the customer.
<?xml version="1.0" encoding="UTF-8"?>
<request timestamp="20180614095601" type="auth-mobile">
<merchantid>MerchantId</merchantid>
<account>internet</account>
<orderid>N6qsk4kYRZihmPrTXWYS6g</orderid>
<amount currency="EUR">1999;</amount>
<mobile>pay-with-google</mobile>
<token>{"signature":"MEUCIQDapDDJyf9lH3ztEWksgAjNe...AXjW+ZM+Ut2BWoTExppDDPc1a9Z7U\u003d","protocolVersion":"ECv1","signedMessage":"{\"encryptedMessage\":\"VkqwkFuMdXp...TZQxVMnkTeJjwyc4\\u003d\",\"ephemeralPublicKey\":\"BMglUoKZWxgB...YCiBNkLaMTD9G4sec\\u003d\",\"tag\":\"4VYypqW2Q5FN7UP87QNDGsLgc48vAe5+AcjR+BxQ2Zo\\u003d\"}"}</token>
<autosettle flag="1"/>
<sha1hash>3231aebe4b60fe23fda3c0ad1b26f03b3ea081e2</sha1hash>
</request>You can test Google Pay in our Sandbox environment. The amount specified in the request will map the tokenized data in the transaction to one of our test cards. For example, an amount of 10.00 will map to the successful Visa test card. For further details, see the Google Pay section in our Test Cards article.
For branding guidelines and to download assets, see Brand Guidelines on the Google Pay website.
For the detailed API specification and a full list of features, see the API Reference section.