Google Pay is not supported by all acquirers and not enabled by default on your account. For more information, contact a member of our support team.
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 REST 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 PaymentData 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:
PAN_ONLY – This authentication method is associated with payment cards stored on file with the user's Google account. Returned payment data includes the FPAN with the expiration month and the expiration year.CRYPTOGRAM_3DS – This authentication method is associated with cards stored as Android device tokens. Returned payment data includes a 3D Secure (3DS) cryptogram generated on the device.PAN_ONLY can expose the FPAN, which requires an additional Strong Customer Authentication (SCA) step up to a 3DS check. Currently, we don't support the Google Pay SCA challenge with an FPAN. For the best acceptance, we recommend that you provide only the CRYPTOGRAM_3DS option.
{
'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>'
}
}
}function onGooglePaymentButtonClicked() {
const paymentDataRequest = getGooglePaymentDataRequest();
paymentDataRequest.transactionInfo = getGoogleTransactionInfo();
const paymentsClient = getGooglePaymentsClient();
paymentsClient.loadPaymentData(paymentDataRequest)
.then(function(paymentData) {
// handle the response
processPayment(paymentData);
})
.catch(function(err) {
// show error in developer console for debugging
console.error(err);
});
}
function processPayment(paymentData) {
// show returned data in developer console for debugging
console.log(paymentData);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();
}public void onActivityResult(int requestCode, int resultCode, Intent data) {
switch (requestCode) {
case LOAD_PAYMENT_DATA_REQUEST_CODE:
switch (resultCode) {
case Activity.RESULT_OK:
PaymentData paymentData = PaymentData.getFromIntent(data);
String token = paymentData.getPaymentMethodToken().getToken();
JSONObject obj = new JSONObject(token);
// Data below goes into the JSON message
string signature = obj.getString("signature");
string protocolVersion = obj.getString("protocolVersion");
string signedMessage = obj.getString("signedMessage");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.
When creating a transaction, use the digital_wallet object to include the payment token instead of the standard card details.
curl --location --request POST 'https://apis.sandbox.globalpay.com/ucp/transactions' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer QeG7aqwDXxyAkqAbOBoDDX5szeC1' \
--header 'Accept: application/json' \
--header 'X-GP-Version: 2020-12-22' \
--data-raw '{
"account_name": "Transaction_Processing",
"channel": "CNP",
"type": "SALE",
"amount": "5",
"currency": "EUR",
"reference": "64970211",
"country": "US",
"payment_method": {
"name": "James Mason",
"entry_mode": "ECOM",
"digital_wallet": {
"provider": "PAY_BY_GOOGLE",
"payment_token": {
{
"signature": "MRUCICT82ONC1THeYgGpgj5ruDKZT2o4YaHV2HXPh4RzPZ7UAiEAkp1E8KQxzCN40PPRhvV5gZFacTOuNxm5GWu0oM9x+Kk=",
"protocolVersion": "ECv1",
"signedMessage": "{\"encryptedMessage\":\"2e/wvcUDfyIYzf6vyc7bVBJwQTWlW6eKkyylR1+Fvs/2zIqOy+7NlSKkbSaUb926VO6bi1yHfnTDoKqo5LLSqKqo3k6kVsqlyCzLjmMO7ns3YlggKeqI39h16cXRB+qzLbKcrIHJEL/A+pBoAEElSoUYN7nVCdDE6bQbhiUg6zqYOMhXQS/6Kfe1HaYYO8q3nycpieW8mN68iAyQwplwp4LuFOaIWOT8IxBl1y1rAikaPEMptVXVAax2kIesiYhfmcaHBpOdq8fdOIl5VkHtRgSKwvsB1RJQtn3W6/Ovldt1h543Ly1ZYWsJwRyw1wBjhBzniRoJMMNA5BDnwXXb6qQ0Kt2DfJx33zerpOH4bd78EpTRXkQUN+Y2NZ+xYRKwc4xoanA6sOJUJMXQeRZ8PNFCcI7djj/iNlvNYCgMUG/P3ylAPdOc/e9dAUwyR9joJM0C\",\"ephemeralPublicKey\":\"BDVZdkLkavmd3kkBKgNgMW5KF7a6GKXATboPoHUzVJXD3bHz/hAWIBY3dvoM6bWN9W2R1QrdjsGRgSYblDg+cyA\\u003d\",\"tag\":\"G3AOG9uYEeFpd6+lsLA+FTYek+8Pi8ELkSqzLo4XKP8\\u003d\"}"
}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 our test cards for Google Pay.
Starter kit for payment integrations.
Guide for Google Pay integration.
For Google Pay branding guidelines and to download assets, see Brand Guidelines on their website.
For the detailed API specification and a full list of features, see the API Explorer.