Integrating Google Pay API
Please Note: As an ISV / Paysafe Partner, you will need to complete all of the below "merchant" steps on behalf of the Parent Merchant Legal Entity (PMLE) that your merchants will be operating under.
To integrate your website with the Google Pay payment method, you must proceed according to the instructions placed at the Google website. Click here to start the Google Pay API integration process.
Before you begin
Before beginning Google Pay integration, ensure you:
- Set up Google Pay to enable payments from your website
- Integrate Google Pay API with Paysafe as your Gateway
- Configure the Google Pay merchant Id
The card type that is supported by Google pay (whether it’s Tokenized/PAN-only or both) depends on your acquirer.
Set Paysafe as your Gateway
You must specify the gateway parameter in the script as Paysafe, as illustrated below:
const tokenizationSpecification = {
type: 'PAYMENT_GATEWAY',
parameters: {
'gateway': 'paysafe',
'gatewayMerchantId': GATEWAY_MERCHANT_ID
You can obtain your GATEWAY_MERCHANT_ID from the following screen in Paysafe Merchant Back Office, under Settings > API Key.
OT-52090 in the above screen under User name is the GATEWAY_MERCHANT_ID in this case.
Accept Google Pay from guests with 3DS cards
To complete a transaction, the 3DS API requires the cardholder's name in addition to the Paysafe payment token. In the case of users who have registered with the merchant, the card holder name can be retrieved from the user profile and sent to Paysafe for processing.
However, if the user is not registered with the merchant (shopping as a guest) and the merchant would like to accept payment via Google Pay, the card holder's name can be retrieved from an optional field ("billingAddress.name") in the Google payload.
{
"apiVersionMinor": 0,
"apiVersion": 2,
"paymentMethodData": {
"description": "",
"tokenizationDate": {
"type": "PAYMENT_GATEWAY",
"token": ""
},
"type": "CARD",
"info":{
"cardNetwork": "",
"cardDetails": "",
"billingAddress": "",
"phoneNumber": "",
"address3": "",
"sortingCode": "",
"address2": "",
"countryCode": "",
"address1": "",
"postalCode": "",
"name": "",
"locality": "",
"administrativeArea": ""
}
}
}
To enable the 3DS flow for unregistered users, the merchant must set the optional parameter "billingAddressRequired" to "true" when configuring the allowed payment methods during their Google integration.
Click here for the Google's documentation on configuring permitted payment methods.
Click here to the Google documentation describing the supported CardParameters, one of which is "billingAddressRequired".
Get holder name from GooglePay for 3DS purposes
For 3DS purposes, collect the holder's name from GooglePay.
The card holder's name is required information for the 3DS flow to be successful. If you need to retrieve the card holder's name from the Google payload, set the optional parameter "billingAddressRequired" to "true" when describing the allowed payment methods during the Google integration (refer to the following page for all supported parameters). The resulting google pay payload can then be passed to the googlesingleusepaytoken endpoint, which will automatically capture the card holder name for 3DS usage.
const baseCardPaymentMethod = {
type: 'CARD',
parameters: {
allowedAuthMethods: allowedCardAuthMethods,
allowedCardNetworks: allowedCardNetworks,
billingAddressRequired: true
}
};