Google Pay
Google Pay integration
Google Pay™ is a payment option for the customer. Google securely stores the customer's card information and hands it over to the merchant for processing. The process ensures that the card information stays secure and encrypted, the merchant does not know the details of the card.
Payment Process
This picture describes the payment process:
- The customer clicks the Google Pay button. A window will pop up where the customer can choose a previously saved card to charge or even provide a new one.
- The JS code receives the encrypted card information.
- The JS code send the encrypted information to the merchant's server side
- The merchant's server side gathers all the information to start a payment and calls the Barion API
- The Barion API handles the request, decrypts the packages and charges the card. The result of the payment is sent back to the caller.
- The merchant's server communicates the result to the client side and the webshop renders the result of the payment.
Integration
These are the steps that you have to complete to use Google Pay on your website:
- Obtain a MerchantId from Google
- Register a wallet in Barion and create a shop
- Implement the Google Pay button on your webshop's client side
- Implement the Barion API call on your webshop's server side
Obtain Google Pay MerchantId
To be able to use Barion as a Google Pay token processor you have to register to Google Pay Console, register your website, and obtain a Google Pay MerchantId.
- You have to have a Google Pay Console account
- Your domain, you want to use Google Pay processor mode on have to be submitted and approved by Google
- Enter your website url, you'd like to integrate with
- Choose Gateway/Átjáró as your Integration type
- Provide screenshots of you buyflow
- Wait for the approval
- You must use the Google Pay MerchantId in your requests, that is provided after the approval
Creating a shop in Barion
To be able to use Barion as a Google Pay token processor you have to register a wallet and open a shop for your webshop.
- You must register a Barion wallet at the Barion website or in the Sandbox environment. Learn more about the Sandbox environment here.
- For this wallet you have to create a shop which should be approved by Barion.
- For every currency you plan to conduct payments in you have to make sure there is an account created in your Barion wallet. This means that if you plan to have USD payments then there should be an USD account created in your wallet.
- To make sure every corner case scenario works for your webshop it is best to topup that account with a small amount (approx. 5-10EUR or your choice of currency around the same value).
Implementing the Google Pay button
First read through the:
in Google's documentation to see what you need to do to accept payments via Google Pay. If your system is ready, follow this Google tutorial to create the JS code that renders the Google Pay button.
How to configure the payment data request?
Gateway id and merchant id
To identify the request towards Google you have to provide two IDs:
- gateway id, the ID that identifies the gateway you are using to process the charges. This is
barion - the gateway merchant id, the ID that identifies your webshop. This can be copied from the detail page of your shop (in Barion)

These IDs must be set in your JS code, like this:
const tokenizationSpecification = {
type: 'PAYMENT_GATEWAY',
parameters: {
'gateway': 'barion',
'gatewayMerchantId': 'PUT HERE YOUR SHOPS MERCHANT ID FROM BARION'
}
};Card types
We support three card types: Discover, MasterCard and Visa. You have to specify this in your JS code:
const allowedCardNetworks = ["MASTERCARD", "VISA", "DISCOVER"];Authentication methods
Currently, we support all authentication methods (cards that already been authenticated with 3DS or via ID&V as network tokens) for Immediate payments (see: PaymentType) that don't specify a recurrence (see: RecurrenceType):
const allowedCardAuthMethods = ["PAN_ONLY", "CRYPTOGRAM_3DS"];For token payments or for non-immediate payments, cryptogram cards are not supported, so please specify:
const allowedCardAuthMethods = ["PAN_ONLY"];If you allow CRYPTOGRAM_3DS for such payments, the user will be able to select a tokenized card from their saved cards list, but the payment will fail.
Billing address
The system needs the billing address, for this the following parameterization must be used:
parameters: {
billingAddressRequired: true,
billingAddressParameters: {
format: "FULL"
}
}Please use the FULL value to specify the format. See BillingAddressParameters for more information.
paymentDataRequest.merchantInfo = {
merchantName: "<<shop name>>",
merchantId: "<<merchantId provided by Google>>"
};Customer e-mail address
To be able to get the e-mail address of the customer, please specify the "emailRequired": true in the PaymentDataRequest. This will the Google API to send back the e-mail address of the Google wallet in the PaymentData object.
Other
Provide the above values for PaymentDataRequest. For further information see | Google Documentation.
Make sure to comply with the Google Brand Guidelines when you place the pay button on your webshop.
Performing 3DS authentication
Barion is performing a 3DS authentication on all transactions except where the one of the following criteria is met:
- a transaction risk analysis is requested and accepted (to request a transaction risk analysis, use the ChallengePreference field),
- the used card is network-tokenized and authenticated via a cryptogram (CRYPTOGRAM_3DS authentication method is used - this depends on the card selected by the user and their device's cryptogram mode support).
In case of Google Pay, merchants need to implement our Off-site 3DS authentication process by using the described css and javascript files in the code of their site. Barion will provide information in the start payment API response about whether a 3DS authentication is required for the given payment - see below.
Implementing the Barion API call
To be able to pass on the encrypted token to Barion you have to implement a Barion API call. For the technical communication guide please read the this: Calling the API.
The endpoint you have to implement is the /v3/Payment/StartPaymentWithGoogleToken. The data that you have to provide here has three key elements:
- all the information about the goods you want to sell
- the e-mail address of the customer (provided by Google)
- the Google Pay token (provided by Google)
Possible error responses
The endpoint can result in any error described at the web payment scenario. Besides those these are the specific error messages for this scenario
| Error code | Description |
|---|---|
| OR_BIBED_11 | The domain registered to Google is invalid. Check your domain in Google Pay Console, and if you've registered it with "www" prefix, try to re-register it without it. Should the problem persist, contact Google. |
| InvalidGoogleToken | The token provided was invalid. Either
|
| InvalidGoogleMessage | The content of the token was invalid. Either
|
| GooglePayNotAllowed | The selected card is a cryptogram card, but the payment's configuration only support pan only cards. Either
This error only happens if the google pay payment button is configured incorrectly and allows CRYPTOGRAM_3DS authentication mode even if the above cases happen. |
3DS authentication
The response of this API endpoint contains the information needed to decide if you need to perform an off-site 3DS authentication. If the ThreeDSAuthClientData field is not empty and the PaymentStatus field is "Prepared" instead of "Successful", a 3DS authentication is required. If the PaymentStatus is "Successful", no 3DS authentication is needed and the payment is already completed.
