Google Pay
Introduction to Google Pay
Google Pay™ (formerly Android Pay) is a digital wallet that streamlines card payments, enabling swift and effortless transactions without the need to repeatedly input card information. Google securely stores the card data. This option is compatible with all devices (mobile phones and computers), irrespective of the operating system and web browser.
When utilizing Google Pay, the Acceptor is required to adhere to the regulations specified in the following regulations.
The following description concerns the direct provision of this service by showcasing the Google Pay lightbox on the payment recipient's website (e-store) or within a mobile application.
If you wish to offer this method via PayU hosted payment page, no additional integration effort is required.
Google Pay Web Integration
For website integration with the Google Pay method, follow these steps:
- API documentation: https://developers.google.com/pay/api/web
- Brand guidelines: https://developers.google.com/pay/api/web/guides/brand-guidelines
The gateway
parameter in the script should have the constant value of payu, according to the example below:
const tokenizationSpecification = {
type: 'PAYMENT_GATEWAY',
parameters: {
gateway: 'payu',
gatewayMerchantId: '[Point of Service Id (pos_id)]',
},
}
The gatewayMerchantId
parameter should be set to the identifier of the payment point where the order is initiated.
Please be aware that PayU, as the processor of Google Pay payments, facilitates the handling of various payment card types issued by Visa and MasterCard organizations, including Maestro. This necessitates configuring the Google script as follows:
const allowedCardNetworks = ['MASTERCARD', 'VISA']
const allowedCardAuthMethods = ['PAN_ONLY', 'CRYPTOGRAM_3DS']
As a response, Google will provide the PaymentData
item, wherein the paymentMethodData.tokenizationData.token
field will include 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, native Google Pay integration is recommended, as Google Pay does not support WebView mode.
For mobile integration with the Google Pay method, follow these steps:
- 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 technical documentation for the PayU | Mobile SDK.
Creating a Google Pay Order
To initiate a charge on the payment card stored within Google Pay, include an extended payMethods
object in the standard order request.
The payMethods.payMethod
object is required to include the authorizationCode
field, where the value corresponds to the Google Pay Token parameter encoded using the Base64 function. Additionally, ensure that the payMethod.value
field is set to the ap value, while the payMethod.type
field should be assigned the PBL value.
"payMethods": {
"payMethod": {
"value": "ap",
"type": "PBL",
"authorizationCode": "eyJzaWduYXR1cmUiOiJNRVVDSVFEWTN3QlF5SEI0c1pja3RSb0pYS3htK09MY2pIekN2ZERlR24yM29YMGtrd0lnS3puUkZaWkwrc0RNdjFiNWN1RCtZdXJYTVpyYVlCc3I5aGJyYXZWWTVSb1x1MDAzZCIsInByb3RvY29sVmVyc2lvbiI6IkVDdjEiLCJzaWduZWRNZXNzYWdlIjoie1wiZW5jcnlwdGVkTWVzc2FnZVwiOlwiY0k4N3RMcXpxVEd5Q0ZuTU1DVldjVEh3M3hoWUlLK0NFbnVRNzRLK25sTHBDZ09sZnBTY2liOWpkczRzeER0TjZDdW5DcUNTTWZkLzN5SGVlUnk2YUN4MXl5cWNUNGV5Nk51ZWVCem5wckpwa21WVmdJMUpIV0xRdDRoekFYTVVBY1lBU1lMT2FiS1A5ZlVadkhrT0JEeXRENTMxanB6TlhhK1NwYy96cnBHekZLeDJDNFZVOXNDOTVxOWkrZXkra3I3Wk1OVkNPRkpQV1h1N2xLWjEwNUlPT3Fveko2LzcwTUtteFAzak04OWVlcSsvMTlRbnlIalFMWGZuUVB2UWppVUpLR0NjUktETGxyYjNYb1k1WlVVekdmTjVlWkNMekNWZzBoV0Vid1UrNko3S1dZSnlXK1dyMXI4YmFnTjl6V3NyTUtoRHBzUWJIZnl6Yit5QnpGVW94ZVVnTDRhN0ZlVnZFbGxJY0h0cXN2VENmNkZFTlYyMGFGNVZMRHY1cXpVa1YrUHpUQUliRkV1YWJBMEdvZDlVYlZDVlZ2N25NOFFGenZSUGh6WVlGVkZUbjRKSHZMMnFaNHBBUjlsRSt3XFx1MDAzZFxcdTAwM2RcIixcImVwaGVtZXJhbFB1YmxpY0tleVwiOlwiQlBITEM0c0JIcGVuWTFNMGl4bWlETXVXSlRhVEpPcWdnUlV3dGdCSk1jQnAyOFZzeEhEN3pQSTc5ODV4NEY1RWpNUDV5OGovY3VVemJlL2NHUGpPS0drXFx1MDAzZFwiLFwidGFnXCI6XCJSYVhyUE9VdWM1aXczb3hEYTBDMk1PamFLeGd4SVJRdndPc3BtdEZWMHpVXFx1MDAzZFwifSJ9"
}
}
Subsequent processing of the request follows the standard procedure outlined in the Create a New Order section.
Keep in mind that you might need to manage the redirection of the request to the 3D Secure authentication page.
Given that orders paid using the Google Pay method are settled similarly to standard card payments, it is worth considering the integration of the service transaction data retrieve. This approach enables the distinction between cards entered via the PayU form and those acquired from Google Pay.
Error Codes in Google Pay
List of standard errors returned by Google Pay lightbox can be found on the Google Developers site.
StatusCode | CodeLiteral | Code | Description |
---|---|---|---|
ERROR_VALUE_INVALID | GOOGLE_PAY_CLIENT_ERROR | 8322 | Validation error. Google Pay token was created for different point of sale. Point of sale IDs used in OrderCreateRequest and in the gatewayMerchantId field must match. |
- Nieoczekiwany błąd po stronie programisty - spróbuj ponownie później - This message is returned, for instance, if the environment parameter is set to PRODUCTION for a Point of Sale (POS) originating from the Sandbox environment.
Testing
The Google Pay payment method is available also under the Sandbox environment – during the integration process, openly indicate the test environment:
var paymentsClient = new google.payments.api.PaymentsClient({
environment: 'TEST',
})