Google Pay

Everything you need to take Google Pay payments via an app:

How it works


  1. You request the encrypted payload from your app

  2. Google Pay returns the encrypted payload following shopper authentication

  3. You send the encrypted payload to your server

  4. You send an XML Direct request to Worldpay containing the encrypted data

  5. We send you the payment response

  6. You inform the shopper of the outcome



You need:

  • ADirector [HPP] (/docs/wpg/hostedintegration/quickstart) integration to Worldpay

  • A Google account

  • Worldpay to enable Google Pay on your account

  • To contact Google in order to add your app to their system for production use.

Merchant ID

When Google Pay is enabled on your Worldpay account, use the WorldpayMAIto generate your own Merchant ID.

Set up Google Pay

For detailed instructions on how to configure Google Pay for in-app payments, seehere.

Integrate with Google Pay

See the Google Payment API guide -

Set the allowedCardNetworks property

Worldpay only supports Google Pay payments with Visa, Mastercard and American Express (Amex) cards.

private PaymentDataRequest createPaymentDataRequest() {
  PaymentDataRequest.Builder request =
  PaymentMethodTokenizationParameters params =
      .addParameter("gateway", "worldpay")
      .addParameter("gatewayMerchantId", "MerchantIdProvidedByWorldpay")

Extract the payload data

Extract the data from the Android device payload using the following:

public void onActivityResult(int requestCode, int resultCode, Intent data) {
  switch (requestCode) {
      switch (resultCode) {
        case Activity.RESULT_OK:
          PaymentData paymentData = PaymentData.getFromIntent(data);
          String token = paymentData.getPaymentMethodToken().getToken();
          JSONObject obj = new JSONObject(token);
          // Data below goes into the XML message
          String signature = obj.getString("signature");
          String protocolVersion = obj.getString("protocolVersion");
          String signedMessage = obj.getString("signedMessage");

Integrate with Worldpay

Prerequisite: You've successfully integrated withGoogle Payto your app, and can generate an encrypted payload.

When you've generated an encrypted payload, and have passed this to your server, send the payload to us within <PAYWITHGOOGLE-SSL>.

Example XML request

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE paymentService PUBLIC "-//WorldPay/DTD WorldPay PaymentService v1//EN"
<paymentService version="1.4" merchantCode="YOUR_MERCHANT_CODE">
    <order orderCode="YOUR_ORDER_CODE" shopperLanguageCode="en">
      <amount value="100" currencyCode="GBP" exponent="2"/>

Example payload

Here's an example of the payload within <PAYWITHGOOGLE-SSL>:


Recurring payments

To take recurring payments you must create a token and follow thestored credentials integration.

Example payment request using tokenisation and stored credentials

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE paymentService PUBLIC "-//WorldPay//DTD WorldPay PaymentService v1//EN" "">
<paymentService version="1.4" merchantCode="YOUR_MERCHANT_CODE">
    <order orderCode="YOUR_ORDER_CODE">
      <description>test order</description>
      <amount value="100" currencyCode="EUR" exponent="2"/>
          <signature>Signature goes here.</signature>
          <signedMessage>Signed message goes here.</signedMessage>
        <session shopperIPAddress="" id="ssn512311246"/>
          <userAgentHeader>Mozilla/5.0 ...</userAgentHeader>
      <createToken tokenScope="shopper">


The responses you receive are the same as a standard shopper, merchant or use tokenresponse. We manage the transactionIdentifier returned by the schemes for cases where there's only ever a single agreement with one cardholder. Store the transactionIdentifer being returned to you for cases where you must handle multiple agreements for one cardholder in a single token.

SCA and PSD2 compliance

To comply with SCA and PSD2 regulations you must send ‘CARD’ based Google Pay transactions through 3DS Secure.

If you are not decrypting the Google Pay payload (and asking Worldpay to handle decryption) then you do not have visibility of the underlying credential being ‘PAN_ONLY or CRYPTOGRAM_3DS’. Therefore you must send the additional 3DS Secure parameters in all of your Google Pay transactions.

If you are decrypting the Google Pay payload, you must only send the 3DS Secure parameters to the PAN_ONLY credential. You must submit the card information and 3DS in the same way as you do for non-Google Pay processing.

const allowedCardAuthMethods = ["PAN_ONLY", "CRYPTOGRAM_3DS"]

PAN_ONLY = PAYWITHGOOGLE PAN-based card credentials that require 3DS.

CRYPTOGRAM_3DS = Tokenised-card-based credentials stored on device that do not require 3D Secure.

You must pass the required 3DS parameters for the version of 3DS you are using. This is the same as for card transactions. Ensure you can handle the 3DS challenge, and display this information to your shopper.

Note: If you are limiting your accepted credentials to just CRYPTOGRAM_3DS in yourGoogle Pay API Integrationthen you do not need to add the additional 3DS fields.

Or refer to ourAuthenticationsection to review all of our authentication integration options.

Contact your Worldpay Relationship Manager or Support team for further assistance.


Google Pay is supported in the Worldpay Sandbox. Please use the WalletConstants.ENVIRONMENT_TEST parameter for any test transactions and the WalletConstants.ENVIRONMENT_PRODUCTION parameter for production transactions.

Worldpay’s Sandbox environment is set up to recognise dummy details and simulate a successful AUTHORISED transaction.

The Google PayTest Card suiteallows you to test Google Pay API without the need of adding real cards to Google accounts.

Testing with 3DS Flex

For Magic Values and where to use them, see the3DS Flexguide.

Google provide further testing detailshere.

Disable Google Pay (HPP integrations only)

Current Worldpay integrations have Google Pay enabled as a default setting.

If you do not want to take payments from Google Pay, follow the instructions in the Merchant Admin Interface guide,MAIto disable it.

You must have an Admin user account to change the Google Pay settings in the MAI. Your Admin user account must also have the permissions for Google Pay management ticked in the user settings.


Google Payment API - Guides and Tutorials

Android Studio

Android Tutorial

Android Test and Deploy

Android Developer Support library

Google's GitHub sample

Create a payment with a decrypted payload