Google Pay
Introduction
Google Pay™ is a digital wallet that lets buyers pay with cards saved in their Google account, without entering card details each time. Google securely stores the card data. Google Pay works on mobile devices and computers, regardless of the operating system and browser.
When using Google Pay, the Acceptor must comply with the Google Pay API Terms of Service.
This page describes how to display the Google Pay button directly on your website or in your mobile app.
If you offer Google Pay on the PayU-hosted payment page, no additional integration is required.
Google Pay Web Integration
To integrate Google Pay on your website, follow the Google documentation:
- API documentation: https://developers.google.com/pay/api/web
- Brand guidelines: https://developers.google.com/pay/api/web/guides/brand-guidelines
In the script, set the gateway parameter to payu, as in the example below:
const tokenizationSpecification = {
type: 'PAYMENT_GATEWAY',
parameters: {
gateway: 'payu',
gatewayMerchantId: '[Point of Service Id (pos_id)]'
}
}
Set the gatewayMerchantId parameter to the ID of the point of sale (POS) on which you create the order.
PayU processes Google Pay payments made with Visa and Mastercard cards (including Maestro). Configure the Google script as follows:
const allowedCardNetworks = ['MASTERCARD', 'VISA']
const allowedCardAuthMethods = ['PAN_ONLY', 'CRYPTOGRAM_3DS']
Google returns a PaymentData object. Its paymentMethodData.tokenizationData.token field contains the encrypted Google Pay token (a string of characters).
{
"signature": "MEUCIQDY3wBQyHB4sZcktRoJXKxm+OLcjHzCvdDeGn23oX0kkwIgKznRFZZL+sDMv1b5cuD+YurXMZraYBsr9hbravVY5Ro\u003d",
"protocolVersion": "ECv1",
"signedMessage": "{\"encryptedMessage\":\"cI87tLqzqTGyCFnMMCVWcTHw3xhYIK+CEnuQ74K+nlLpCgOlfpScib9jds4sxDtN6CunCqCSMfd/3yHeeRy6aCx1yyqcT4ey6NueeBznprJpkmVVgI1JHWLQt4hzAXMUAcYASYLOabKP9fUZvHkOBDytD531jpzNXa+Spc/zrpGzFKx2C4VU9sC95q9i+ey+kr7ZMNVCOFJPWXu7lKZ105IOOqozJ6/70MKmxP3jM89eeq+/19QnyHjQLXfnQPvQjiUJKGCcRKDLlrb3XoY5ZUUzGfN5eZCLzCVg0hWEbwU+6J7KWYJyW+Wr1r8bagN9zWsrMKhDpsQbHfyzb+yBzFUoxeUgL4a7FeVvEllIcHtqsvTCf6FENV20aF5VLDv5qzUkV+PzTAIbFEuabA0God9UbVCVVv7nM8QFzvRPhzYYFVFTn4JHvL2qZ4pAR9lE+w\\u003d\\u003d\",\"ephemeralPublicKey\":\"BPHLC4sBHpenY1M0ixmiDMuWJTaTJOqggRUwtgBJMcBp28VsxHD7zPI7985x4F5EjMP5y8j/cuUzbe/cGPjOKGk\\u003d\",\"tag\":\"RaXrPOUuc5iw3oxDa0C2MOjaKxgxIRQvwOspmtFV0zU\\u003d\"}"
}
Google Pay Android Integration
For mobile applications, we recommend the native Google Pay integration.
Buyers can also pay with Google Pay on the PayU page loaded in a WebView. This requires additional WebView configuration, as described in the Google Pay documentation.
To integrate Google Pay in your Android app, follow the Google documentation:
- API documentation: https://developers.google.com/pay/api/android
- Brand guidelines: https://developers.google.com/pay/api/android/guides/brand-guidelines
To make the integration easier, use the PayU Mobile SDK.
Creating a Google Pay Order
To charge a card saved in Google Pay, extend the standard order request with the payMethods object:
payMethod.value– set toap,payMethod.type– set toPBL,payMethod.authorizationCode– the Google Pay token encoded in Base64. If the Google Pay token comes from the PayU Mobile SDK, do not encode it in Base64 again.
"payMethods": {
"payMethod": {
"value": "ap",
"type": "PBL",
"authorizationCode": "eyJzaWduYXR1cmUiOiJNRVVDSVFEWTN3QlF5SEI0c1pja3RSb0pYS3htK09MY2pIekN2ZERlR24yM29YMGtrd0lnS3puUkZaWkwrc0RNdjFiNWN1RCtZdXJYTVpyYVlCc3I5aGJyYXZWWTVSb1x1MDAzZCIsInByb3RvY29sVmVyc2lvbiI6IkVDdjEiLCJzaWduZWRNZXNzYWdlIjoie1wiZW5jcnlwdGVkTWVzc2FnZVwiOlwiY0k4N3RMcXpxVEd5Q0ZuTU1DVldjVEh3M3hoWUlLK0NFbnVRNzRLK25sTHBDZ09sZnBTY2liOWpkczRzeER0TjZDdW5DcUNTTWZkLzN5SGVlUnk2YUN4MXl5cWNUNGV5Nk51ZWVCem5wckpwa21WVmdJMUpIV0xRdDRoekFYTVVBY1lBU1lMT2FiS1A5ZlVadkhrT0JEeXRENTMxanB6TlhhK1NwYy96cnBHekZLeDJDNFZVOXNDOTVxOWkrZXkra3I3Wk1OVkNPRkpQV1h1N2xLWjEwNUlPT3Fveko2LzcwTUtteFAzak04OWVlcSsvMTlRbnlIalFMWGZuUVB2UWppVUpLR0NjUktETGxyYjNYb1k1WlVVekdmTjVlWkNMekNWZzBoV0Vid1UrNko3S1dZSnlXK1dyMXI4YmFnTjl6V3NyTUtoRHBzUWJIZnl6Yit5QnpGVW94ZVVnTDRhN0ZlVnZFbGxJY0h0cXN2VENmNkZFTlYyMGFGNVZMRHY1cXpVa1YrUHpUQUliRkV1YWJBMEdvZDlVYlZDVlZ2N25NOFFGenZSUGh6WVlGVkZUbjRKSHZMMnFaNHBBUjlsRSt3XFx1MDAzZFxcdTAwM2RcIixcImVwaGVtZXJhbFB1YmxpY0tleVwiOlwiQlBITEM0c0JIcGVuWTFNMGl4bWlETXVXSlRhVEpPcWdnUlV3dGdCSk1jQnAyOFZzeEhEN3pQSTc5ODV4NEY1RWpNUDV5OGovY3VVemJlL2NHUGpPS0drXFx1MDAzZFwiLFwidGFnXCI6XCJSYVhyUE9VdWM1aXczb3hEYTBDMk1PamFLeGd4SVJRdndPc3BtdEZWMHpVXFx1MDAzZFwifSJ9"
}
}
The rest of the process is the same as for a standard order.
If the payment requires 3D Secure authentication, redirect the buyer to the authentication page.
Orders paid with Google Pay are settled in the same way as standard card payments. To distinguish cards entered in the PayU form from cards provided by Google Pay, consider integrating Transaction Data Retrieval.
Recurring Payments and Tokenization Using Google Pay
Cards saved in Google Pay can be used for recurring payments and creating multi-use tokens.
To save a Google Pay card for later payments, set recurring or cardOnFile to FIRST in the first order. The response contains a multi-use token (TOKC_), which you then use for subsequent payments, as described in Charging Tokens. The first payment can also be for a zero amount.
Error Codes in Google Pay
For the list of standard errors returned by the Google Pay lightbox, see the Google Developers site.
| Description | |||
|---|---|---|---|
ERROR_VALUE_INVALID | GOOGLE_PAY_CLIENT_ERROR | 8322 | Validation error. The Google Pay token was created for a different point of sale. The POS ID in the order request and in the gatewayMerchantId field must match. |
- Unexpected developer error, please try again later – returned, for example, when the
environmentparameter is set toPRODUCTIONfor a POS from the Sandbox environment.
Testing
Google Pay is also available in the Sandbox environment. During integration, set the environment to TEST:
const paymentsClient = new google.payments.api.PaymentsClient({
environment: 'TEST'
})