Google Pay

By integrating Google Pay into your website or Android application, your customers can securely make one-touch payments using any credit or debit card connected to their Google account.

To start processing Google Pay payments, you must first integrate directly with Google. Once integration is complete, you can add the 'Google Pay' button to your checkout page and start requesting your customers' encrypted payment information.

To simplify the process, we've condensed a Google Pay payment into a three-step method.

Please note:

Google Pay is currently available to EU and US merchants.

Process a payment with Google Pay

Step 1: Integrate with Google Pay

Please note:

Before going live, merchants are required to register with Google Pay and select Checkout.com as your payment processor.

For information on integrating with Google Pay, first, refer to the Google Pay API guide.

When you submit a payment data request to the Google API, be sure to include the following parameters:

'gateway': 'checkoutltd'
'gatewayMerchantId': '<your Public Key>'

Example for web

'allowedPaymentMethods': ['CARD','TOKENIZED_CARD'],
'paymentMethodTokenizationParameters': {
   'tokenizationType': 'PAYMENT_GATEWAY',
   'parameters':    {
     'gateway': 'checkoutltd'
     'gatewayMerchantId': '<replace with your Public Key>'
   }
}

Example for Android

private PaymentDataRequest createPaymentDataRequest() {
    PaymentDataRequest.Builder request =
        PaymentDataRequest.newBuilder()
            .setTransactionInfo(
                TransactionInfo.newBuilder()
                    .setTotalPriceStatus(WalletConstants.TOTAL_PRICE_STATUS_FINAL)
                    .setTotalPrice("10.00")
                    .setCurrencyCode("USD")
                    .build())
            .addAllowedPaymentMethod(WalletConstants.PAYMENT_METHOD_CARD)
            .addAllowedPaymentMethod(WalletConstants.PAYMENT_METHOD_TOKENIZED_CARD)
            .setCardRequirements(
                CardRequirements.newBuilder()
                    .addAllowedCardNetworks(
                        Arrays.asList(
                            WalletConstants.CARD_NETWORK_VISA,
                            WalletConstants.CARD_NETWORK_MASTERCARD))
                    .build());

    PaymentMethodTokenizationParameters params =
        PaymentMethodTokenizationParameters.newBuilder()
            .setPaymentMethodTokenizationType(
                WalletConstants.PAYMENT_METHOD_TOKENIZATION_TYPE_PAYMENT_GATEWAY)
            .addParameter("gateway", "checkoutltd")
            .addParameter("gatewayMerchantId", "<replace with your Public Key>")
            .build();

    request.setPaymentMethodTokenizationParameters(params);
    return request.build();
}

Please note:

You will need to specify which card types and card schemes to support in your payment data request. Checkout.com and Google Pay support the use of both Visa and Mastercard.

Step 2: Tokenize the Google Pay payment data

Once you have received the payment data from Google, you then need to call Checkout.com’s endpoint for tokenizing the encrypted payment data; you can find this payment data in the paymentMethodToken property of the Google Pay payment data request's response.

To find out more about Google Pay payment requests, read the Google Pay object reference.

The request

Requests are created using a POST request and should be performed on the client-side. Use the details below to set up your request.

Endpoint live

https://api2.checkout.com/tokens

Header parameters

Header
Value

Authorization:
Required

public key*

Content-Type:
Required

application/json

*For authorization, use the valid public key of your Checkout.com account. You can find this in The Hub.

Request example

This following code snippet is an example of the request body for an Google Pay payment.

{
  "type": "googlepay",
  "token_data": {
    "signature": "MEUCIDh3...yI1A=",
    "protocolVersion": "ECv1",
    "signedMessage": "{\"encryptedMessage\": \"ZW5jcnlwdGVkTWVzc2FnZQ==\",
                          \"ephemeralPublicKey\": \"ZXBoZW1lcmFsUHVibGljS2V5\",
                            \"tag\": \"c2lnbmF0dXJl\"}"
  }
}

The response

{
  "type": "googlepay",
  "token": "tok_ubfj2q76miwundwlk72vxt2i7q",
  "expires_on": "2018-03-15T15:36:54Z"
}

Additional parameters

Request payload fields

protocolVersion
String
required

Identifies which encryption/signing scheme this message has been created. In this way, the protocol can evolve over time if needed. If it is not set, assume ECv0.

signature
String
required

Verifies the message came from Google. The signature is created using ECDSA.

signedMessage
String
required

A serialized JSON string containing the encryptedMessage, ephemeralPublicKey and tag. To simplify the signature verification process, this value is serialized.

Step 3: Authorize a payment using Google Pay

Now you have the token, it's time to authorize the payment. Grab the token, and use it in the body of a card token payment request from your application or website's backend server.

Testing Google Pay in sandbox

Google Pay does not allow the configuration of test cards within its online wallet. However, when using Google's test environment, if a real card is selected when making the online purchase, Google Pay provides a test card in the encrypted payment data; ensuring that no actual transaction takes place.

Find out more about testing and simulating payments.

Can we help?

Thanks for using Checkout.com. If you need any help or support, then message our support team at support@checkout.com.