Overview
This guide describes the steps to integrate Google Pay as a Nuvei APM into your payment flow using the Nuvei Server-to-Server REST API platform.
Google Pay Integrations
Setting up the Google Pay UI
Setting up the Google Pay UI is the first step of all the implementations.
Nuvei supports the following integrations:
- Payments – Nuvei Decrypts the Token
You can send the Google Pay token as is in the Non-3DS Payments requests, and “behind the scenes”, Nuvei decrypts and uses the relevant data extracted from the token. This allows you to send the Google Pay token in a/payment
request (without 3DS).
- Recurring Payments
You can perform both Initial Recurring Payments and Subsequent Recurring Payments using the encrypted Google Pay token.
Prerequisites and Notes
- This guide assumes you have completed all account setup prerequisites, and are ready to integrate Google Pay into your payment flow.
- Use these gateway credentials in requests:
- For the test (sandbox) environment:
gatewayMerchantId
: “googletest“ - For the production environment:
gatewayMerchantId
: “nuveidigital“
- For the test (sandbox) environment:
- The Google Pay Web environment must be set up according to the Google Pay guidelines:
- Google Pay Web Developer Documentation
- Google Pay Brand Promoting Guidelines
For your domain to be verified with Google, the merchant must send Nuvei’s Integration Team screenshots (like the one shown below) of your payment flow along with your domain URL:
- Google Pay Test Card Suite
- Google Pay Web Integration Checklist
- The Google account used for testing should be linked to a relevant test card:
- Google Pay provides test cards, see Google Pay Test Card Suite for details.
- Alternatively, you can use one of the test cards listed in the Testing Cards topic.
Test credentials and testing scenarios can be provided by Nuvei if necessary.
You can contact Nuvei Support for any assistance.
- The first time a card is used in the Google Pay system, Google Pay performs a 3DS authentication and stores the 3DS values from the successful Google Pay authentication in a Google Pay token.
- Google Pay supports recurring payments only if you (the merchant) confirm to the following policies:
- The Merchant must comply with the network rules, especially the merchant-initiated transactions (MIT) rules.
- The Merchant must disclose the “Terms of payment” within the Merchant’s “buyflow”, and the customer must accept the “Terms of payment”.
Google Pay as an “External Token Provider”
An external token provider is a type of entity in the payment industry with its own flow (for example Google Pay and Apple Pay).
These providers typically:
- Collect the customer payment method and transaction details.
- In some cases, they perform 3D-Secure authentication and provide the 3D-Secure authentication values.
Set up the Google Pay UI
1. Authentication
You need to provide an authorization header with a bearer token required for the API requests, see 2. Authentication topic.
2. The Google Pay UI Button
3. Collect the Card Details
Pressing the Google Pay button collects your customer’s card details and returns them to you as an encrypted Google Pay token.
- The customer triggers the Google Pay payment flow by pressing the Google Pay button.
- Google Pay displays all the cards associated with the customer’s Google account, or asks the customer to “Add new credit or debit card” details.
- The customer selects a payment method and Google Pay returns the encrypted Google Pay token (containing the
paymentMethod
block in JSON format).
Nuvei Decrypts Token
Use this integration when you manage the Google Pay Button yourself in your own payment flow, and now you want to send a payment request.
The Google Pay token contains Google Pay authentication values from a successful Google Pay authentication. You can send the Google Pay token “as-is” in a /payment
request, and “behind the scenes”, Nuvei decrypts and uses the relevant data contained in the token.
Non-3DS Payments
This allows you to send the Google Pay token in a /payment
request without sending any 3DS values.
Call the /payment
REST API request with its mandatory parameters. Include the data received on your server, in the eWallet
block with these parameters:
paymentOption.eWallet.provider
: “GooglePay“paymentOption.eWallet.token
: “<encrypted GooglePay Token converted to a string>”
buyerDetails.buyerId
: “<unique customer identifier in the merchant system>” – Required for payment token creation.
Example /payment
Request for Non-3DS
{ "processingEntityId": "<your processingEntityid>", "amount": "10.5", "currency": "USD", "paymentOption": { "store": "buyerToken", "eWallet": { "provider": "GooglePay", "token": "<encrypted GooglePay Token converted to a string>" } }, "deviceDetails": { "ipAddress": "<customer's IP address>" }, "buyerDetails": { "buyerId": "<unique customer identifier in your system>", "email": "[email protected]", "billingAddress": { "countryCode": "US" } } }
Example /payment
Response for Non-3DS
{ "paymentId": "494321", "transactionId": "1110000000009891682", "externalTransactionId": "211011237407", "amount": "10.5", "currency": "USD", "transactionType": "Sale", "result": { "status": "approved" }, "authCode": "465190", "partialApproval": { "requestedAmount": "85.11", "requestedCurrency": "USD" }, "paymentOption": { "eWallet": { "provider": "GooglePay", "eciIndicator": "07", "expirationMonth": "12", "expirationYear": "2028" } } }
Recurring Payments
Follow these steps to integrate Google Pay recurring payments into your payment flow.
Recurring payments involves two types of payments:
- The Initial recurring payment
- One or more Subsequent recurring payments
Complete the payment using the relevant flow:
For Initial Recurring Payments
Send a /payment
request with its mandatory parameters and include these additional parameters:
rebill.step
: “init” – To indicate that this is the initial transaction.- Include the authorized token received from Google Pay, in the
eWallet
block with the following parameters:provider
: “GooglePay“token
: “<the encrypted data generated by Google Pay>”
Example /payment
Request Initial Recurring Payments
{ "processingEntityId": "<your processingEntityid>", "amount": "10.5", "currency": "USD", "paymentOption": { "store": "buyerToken", "eWallet": { "provider": "GooglePay", "token": "<encrypted GooglePay Token converted to a string>" } }, "deviceDetails": { "ipAddress": "<customer's IP address>" }, "rebill": { "step": "init" }, "buyerDetails": { "buyerId": "<unique customer identifier in your system>", "email": "[email protected]", "billingAddress": { "countryCode": "US" } } }
Example /payment
Response for Initial Recurring Payments
{ "paymentId": "494021", "transactionId": "1110000000009891682", "externalTransactionId": "211011237407", "amount": "10.5", "currency": "USD", "transactionType": "Sale", "result": { "status": "approved" }, "authCode": "465190", "partialApproval": { "requestedAmount": "85.11", "requestedCurrency": "USD" }, "paymentOption": { "eWallet": { "provider": "GooglePay", "eciIndicator": "07", "expirationMonth": "12", "expirationYear": "2028" } } }
For Subsequent Recurring Payments
To complete the payment flow for subsequent recurring payments, send the /payment
requests with their mandatory parameters and include these additional parameters:
buyerDetails.buyerId
: “<unique customer identifier in the merchant system>”rebill.step
: “recurring” – Indicates that it is a subsequent transaction.relatedTransactionId
: “<transactionId
of the initial payment>”paymentTokenId
: “<paymentTokenId
returned from the initial recurring request>“
Example /payment
Request for a Subsequent Recurring Payment
{ "processingEntityId": "<your processingEntityid>", "amount": "10.5", "currency": "USD", "relatedTransactionId": "<transactionId of the initial payment>", "paymentOption": { "paymentToken": { "paymentTokenId": "<payment token id generated by Nuvei>" }, "deviceDetails": { "ipAddress": "<customer's IP address>" }, "rebill": { "step": "recurring" }, "buyerDetails": { "buyerId": "<unique customer identifier in your system>", "email": "[email protected]", "billingAddress": { "countryCode": "US" } } } }