Google Pay™

Google Pay allows customers to securely complete payments using credit or debit cards linked to their Google account. Evervault has built-in support for Google Pay. Our Google Pay component will intercept the Google Pay token and provide you with direct access to the encrypted payment method, which can then be sent to any payment processor using Relay.

Getting Started


All users of Google Pay must agree to the Google Pay Terms and Conditions.

Create a Merchant


Before you can use Google Pay, you will need to create a merchant record to use for the transaction. You can create a Merchant from inside the payments section in the Evervault Dashboard or via the Merchants API.

Install the SDK


Our JavaScript SDK is distributed from our CDN, and can be installed by placing this script tag in the head of your HTML file. The SDK must be loaded directly from our CDN and cannot be bundled with your application or self hosted.

Once the SDK is installed, initialize it using your Team ID and App ID. You can find these in the Evervault Dashboard.

You can also install Evervault via the @evervault/js package on npm. This package is a light wrapper which handles loading the SDK from our CDN and also provides TypeScript definitions.

Frequently Asked Questions

Create a transaction


Next, you will need to create a transaction to describe the payment you want to process. You will need to provide the amount, currency, country, and merchant details for the transaction.

Mount a Google Pay component


Now that you have created a transaction, you can create and mount the Google Pay component to display the Google Pay button to your users. The Google Pay component takes the transaction you created as a first argument and an options object with a process function that will be called with the encrypted payment method when the user completes the payment.

Process the payment


The process function is an async function that is called when the user authorizes the payment. Typically you will want to forward the encrypted payment method to your backend in order to process the payment. You can use Relay to forward the encrypted payment method to any third party payment processor.

Google Pay can return either a networkToken or a card object. Typically this depends on whether the transaction was initiated and authenticated via biometrics on a mobile device, or via a web browser on a desktop device.

Network tokens ofer inherent security due to their device-bound nature. However, responses containing only card details carry a higher risk and require additional authentication steps. We recommend leveraging our 3D Secure API to perform this necessary authentication for card-based responses.

Error handling


Errors while processing the payment


The process function also accepts a second argument which is an object of helper methods. This object includes a fail function that can be called with an error message to display an error to the user in the event of an error during payment processing.

Errors while rendering the component


In the rare event that the Google Pay component fails to render, you can handle the error by listening to the error event.

Use Google Pay with your PSP


You can use Evervault's Google Pay integration with any PSP. This means you:

  • Don't use your PSP's Google Pay integration.
  • Preferably use network tokens with your PSP's APIs.

When Google Pay returns a network token, use it for all payments, retries, etc. with your PSP. There's no additional configuration (e.g., certificates) with your PSP or Google needed. Most PSPs have network token APIs and parameters for passing network token data. Like other 3rd party API calls, use Relay to decrypt network token data and send it to your PSP.

Customization


Google Pay allows you to customize the appearance of the payment button with various predefined styles. These can be passed as additional options when initializing the Google Pay component. You can see all of the available options in the JS SDK documentation.

Configuration


Google Pay allows you to specify the authorization methods and card networks that are supported by your merchant. This can be done by passing the allowedAuthMethods and allowedCardNetworks options when initializing the Google Pay component. You can see the available options in the JS SDK.

3D Secure


Google Pay supports encrypted and non-encrypted payment methods. Encrypted payment methods are preferred as they provide enhanced security and reduced fraud. Non-encrypted payment methods are also supported, and when used can subsequently be submitted for authentication via our 3D Secure API. See our 3D Secure Guide for more information. You can directly pass the encrypted card number string from the returned payment method to our 3DS API to perform an authentication.

Content Security Policy (CSP)


If you are using a Content Security Policy (CSP), you will need to add the following directives to allow the Evervault SDK to function correctly.