Accepting payments with Google Pay™

Note this Google Pay is currently in the beta phase, and is subject to change.

Additionally to accepting payments by card, Google Pay lets you provide your customers with a one-click checkout process using cards stored in their Google account.


Setting up Google Pay

Before integrating Google Pay and tokenizing the cards of your customers, you must be integrated with Google directly. There are a few pre-requisites you must complete prior to start initiating transactions using Google Pay on ProcessOut.

1. Integrate with Google Pay

To start things off, you must firstly integrate directly with Google Pay ↗. Depending on the type of integration you require, web or android, there are these following guides which will assist you:

Android devices

Web

ProcessOut Specifics

When you submit your request to Google Pay there are a few parameters that have to be filled with specific values, namely the following fields:

"gateway": "processout"
"gatewayMerchantId" : "<your project ID (include the 'test-' prefix for sandbox mode transactions)>"

Example code

{
  "type": "CARD",
  "parameters": {
    "allowedAuthMethods": [
      "PAN_ONLY",
      "CRYPTOGRAM_3DS"
    ],
    "allowedCardNetworks": [
      "AMEX",
      "DISCOVER",
      "JCB",
      "MASTERCARD",
      "VISA"
    ]
  },
  "tokenizationSpecification": {
    "type": "PAYMENT_GATEWAY",
    "parameters": {
      "gateway": "processout",
      "gatewayMerchantId": "<your project ID (include the 'test-' prefix for sandbox mode transactions)>"
    }
  }
}

As seen in the example above, there are also other customizable fields present. ProcessOut supports both authorization methods: PAN_ONLY and CRYPTOGRAM_3DS. We also do not restrict the allowed card networks, as this is a constraint provided by the PSP. Please refer to them to confirm which card networks they support.

2. Create a ProcessOut card token using a Google Pay token

When a Google Pay transaction is successfully initiated, a token will be returned from Google. This token ↗ will be available as a JSON object string at: paymentMethodData.tokenizationData.token. This token is what is required by ProcessOut in order to process the payment method.

Android

We provide an Android SDK ↗ in order for you to generate a card token, which can then be passed to your backend to process payments. The request will require you to base64encode the Google Pay token (JSON object string) received from the steps above.

Example Google Pay Token

{"signature":"MEUCIQDi3Yy3uEf9EvOodY43dvlalWRp4t4kS/r3MJMFZZS09QIgS/3yLTSKjF+kmGJiXIKdfmaR8r8aaZEAcI4OlCySPs0\u003d","intermediateSigningKey":{"signedKey":"{\"keyValue\":\"MFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAEd0iHKh9XaxOKYFvGvrMHbXk3/Sig0ofeDBCiBmnu2Y5OvB2DU9Fyikd3sujtGm7WkfXbQ7rm5PLEr9jBXS7H2g\\u003d\\u003d\",\"keyExpiration\":\"1631090989783\"}","signatures":["MEYCIQCbTLYYpNmu/B2HVFuSHQ6kE/wa5g+eqTULpaRmc+2WGAIhAIQxFgxrgy3NAUXDVRv58wISpiyDrhQy8jx1HxtHWfpb"]},"protocolVersion":"ECv2","signedMessage":"{\"encryptedMessage\":\"sme1OeYeVwkc7lZfK1tT25KCrj1/pZDRXyCFvF9BCBXD6UQbP9+owMc1u7EIQ20j8i1uA2PIeivIxDfBkKMOgFdIyQliTuN4VO/x5r82gW0BOdRwwyWDL5TP+3HdGJ+hSMk/h1n6a1DmnNqjJKPe64Say4jlhOdY/X6k297Je9NO5eIsz/JBDfdl7KzNhARQsDFXaB03SrbtvEtOflQ9pWNDCuCKgDwL9cY5+OmqZrWW32F6N9RzeX9rpnq+p0t17n4F9ogstgQ52eh+El3BjR+78NimK2jLjFHHI5pWEpGlrshS+oQEgPS5tc4l2iES1IZIV2ZsfH7Gb1+ecBCgjhQyZQOw2fwB3jkVz5dOjASoYrTKRnJyNbWhIcjDmDSwzqq08JmX1KdShglZaCFYmIujKSV5Pa6ESUxrWuQU0T0FMzLEsOlJj1/muu2jEDVhBA4XVL3qmHHOQkU85cZU77JtbU1fMUypzPW6BGL5jQmGL5TDQa+5TDV0dHL8wLITRkbsa0VyLQtSLUSZ9A\\u003d\\u003d\",\"ephemeralPublicKey\":\"BBca3VePV8f6Y64YhTsuwsWo79EOKimbPnViqoHz+5WYR/1dtZu2kIMNsybNZlwnbi7n2keoVgEyh2vSRBEsW+o\\u003d\",\"tag\":\"PsKT9TGD6+f99dnnoZh0zTVge1U+s1cN1kn+g0cAUbc\\u003d\"}"}

Example Base64encoded token

eyJzaWduYXR1cmUiOiJNRVVDSVFEaTNZeTN1RWY5RXZPb2RZ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wR2xyc2hTK29RRWdQUzV0YzRsMmlFUzFJWklWMlpzZkg3R2IxK2VjQkNnamhReVpRT3cyZndCM2prVno1ZE9qQVNvWXJUS1JuSnlOYldoSWNqRG1EU3d6cXEwOEptWDFLZFNoZ2xaYUNGWW1JdWpLU1Y1UGE2RVNVeHJXdVFVMFQwRk16TEVzT2xKajEvbXV1MmpFRFZoQkE0WFZMM3FtSEhPUWtVODVjWlU3N0p0YlUxZk1VeXB6UFc2QkdMNWpRbUdMNVREUWErNVREVjBkSEw4d0xJVFJrYnNhMFZ5TFF0U0xVU1o5QVxcdTAwM2RcXHUwMDNkXCIsXCJlcGhlbWVyYWxQdWJsaWNLZXlcIjpcIkJCY2EzVmVQVjhmNlk2NFloVHN1d3NXbzc5RU9LaW1iUG5WaXFvSHorNVdZUi8xZHRadTJrSU1Oc3liTlpsd25iaTduMmtlb1ZnRXloMnZTUkJFc1crb1xcdTAwM2RcIixcInRhZ1wiOlwiUHNLVDlUR0Q2K2Y5OWRubm9aaDB6VFZnZTFVK3MxY04xa24rZzBjQVViY1xcdTAwM2RcIn0ifQo=

Example code

// Optional add the contact information of the cardholder
Contact contact = new Contact(address1, address2, city, state, countryCode, zip);

// First create a card object containing the Google Pay token details
Card card = new Card(Card.TokenType.googlepay, "base64encoded Google Pay token", cardHolderName, contact);

// And then send the card data to ProcessOut to tokenize
client.tokenize(card, new TokenCallback() {
    @Override
    public void onSuccess(String token) {
        // Send the card token to your backend for charging
    }

    @Override
    public void onError(Exception error) {
        Log.e("ProcessOut", error.toString());
    }
});

Web

We provide ProcessOut.js ↗ which can handle creating a ProcessOut Google Pay™ token for you. In order to make use of ProcessOut.js you must first load the javascript on your page. It is mandatory for regulation reasons to always load it from our CDN as shown below, to ensure you always have the latest version.

<script src="https://js.processout.com/processout.js"></script>

You can now generate your customer’s Google Pay™ token, using the below example code as a basis. It is important to note that there is no need to base64encode the Google Pay token when using ProcessOut.js, as this is handled by the javascript code.

Example code

var client = new ProcessOut.ProcessOut("test-proj_gAO1Uu0ysZJvDuUpOGPkUBeE3pGalk3x");

var data = {
    // It is possible to send cardholder information (optional)
    name: document.getElementById("cardholdername").value,
    contact: {
        zip: document.getElementById("cardholderzip").value,
        // Available contact fields:
        // address1, address2, city, state, country_code, zip
      },
};

// Note: payload is set to the Google Pay token received from the steps above
var payload = {
    "signature": "MEUCIQDi3Yy3uEf9EvOodY43dvlalWRp4t4kS/r3MJMFZZS09QIgS/3yLTSKjF+kmGJiXIKdfmaR8r8aaZEAcI4OlCySPs0\u003d",
    "intermediateSigningKey": {
        "signedKey": "{\"keyValue\":\"MFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAEd0iHKh9XaxOKYFvGvrMHbXk3/Sig0ofeDBCiBmnu2Y5OvB2DU9Fyikd3sujtGm7WkfXbQ7rm5PLEr9jBXS7H2g\\u003d\\u003d\",\"keyExpiration\":\"1631090989783\"}",
        "signatures": ["MEYCIQCbTLYYpNmu/B2HVFuSHQ6kE/wa5g+eqTULpaRmc+2WGAIhAIQxFgxrgy3NAUXDVRv58wISpiyDrhQy8jx1HxtHWfpb"]
    },
    "protocolVersion": "ECv2",
    "signedMessage": "{\"encryptedMessage\":\"sme1OeYeVwkc7lZfK1tT25KCrj1/pZDRXyCFvF9BCBXD6UQbP9+owMc1u7EIQ20j8i1uA2PIeivIxDfBkKMOgFdIyQliTuN4VO/x5r82gW0BOdRwwyWDL5TP+3HdGJ+hSMk/h1n6a1DmnNqjJKPe64Say4jlhOdY/X6k297Je9NO5eIsz/JBDfdl7KzNhARQsDFXaB03SrbtvEtOflQ9pWNDCuCKgDwL9cY5+OmqZrWW32F6N9RzeX9rpnq+p0t17n4F9ogstgQ52eh+El3BjR+78NimK2jLjFHHI5pWEpGlrshS+oQEgPS5tc4l2iES1IZIV2ZsfH7Gb1+ecBCgjhQyZQOw2fwB3jkVz5dOjASoYrTKRnJyNbWhIcjDmDSwzqq08JmX1KdShglZaCFYmIujKSV5Pa6ESUxrWuQU0T0FMzLEsOlJj1/muu2jEDVhBA4XVL3qmHHOQkU85cZU77JtbU1fMUypzPW6BGL5jQmGL5TDQa+5TDV0dHL8wLITRkbsa0VyLQtSLUSZ9A\\u003d\\u003d\",\"ephemeralPublicKey\":\"BBca3VePV8f6Y64YhTsuwsWo79EOKimbPnViqoHz+5WYR/1dtZu2kIMNsybNZlwnbi7n2keoVgEyh2vSRBEsW+o\\u003d\",\"tag\":\"PsKT9TGD6+f99dnnoZh0zTVge1U+s1cN1kn+g0cAUbc\\u003d\"}"
};

var token = new ProcessOut.PaymentToken(ProcessOut.TokenType.GooglePay, payload)
client.tokenize(token, data,
    function(token) {
        document.getElementById("success").innerHTML = "Success! Your created card token is " + token;
    },
    function(err) {
        document.getElementById("errors").innerHTML = err.message;
    });

3. Charge the customer

Once you have successfully tokenized the Google Pay token on ProcessOut, you will receive back a card.id. This can be sent to your backend, and can be used to charge your customers ↗ or save it on a customer token ↗.

Note: We only recommend capturing the transaction from the backend if you have made the request to Google with allowedAuthMethods to be solely CRYPTOGRAM_3DS otherwise the transaction may be subject to SCA, as explained in the next section.

Strong Customer Authentication

ProcessOut.js and ProcessOut mobile SDKs are SCA and 3DS2-ready, meaning that the new requirements mandated by new regulations in Europe will be handled automatically for you.

If you created a payment request on Google with allowedAuthMethods including PAN_ONLY, it may be subject to SCA (Strong Customer Authentication). In order to ensure you are ready to support SCA, please refer to the following relevant documentation:

This is not required if you solely select “CRYPTOGRAM_3DS” as your auth method.