Google Pay

Everything you need to take Google Pay payments by web or app:

How it works


  1. You request the encrypted payload from your app or website

  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

  • To use Worldpay as your acquirer

  • 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 WorldpayMAI(Merchant Administration Interface) to generate your own Merchant ID.

Set up Google Pay

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

There is no integration required for Hosted Payment Page integration but there are some things you need to be aware of. See theHosted Payment Page sectionof this guide for details.

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">
      <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.

Hosted Payment Pages

If you use our Hosted Payment Pages (HPP), Google Pay may have been enabled by default.

Supported hosted payment page options for Google Pay:

  • Re-direct
  • Lightbox
  • iFrame

For more information on these payment page options, refer to Worldpay'sHosted Payment Page guide.

Add Google Pay (HPP payments only)

To add Google Pay to HPP, follow the instructions in the WorldpayMAI guide.

Google Pay do not allow the use of webview inside an app for hosted payments. We recommend you redirect the shopper out of the app to a web browser.

Google Pay is automatically presented as a payment option at the point of payment (the same as any other payment option you have enabled). Google Pay needs to know the previous page the shopper was on. prior to landing on HPP. There are, however instances where Google Pay is unable to determine the previous page. This can occur when the payment options are presented by Pay by Link (where your customer is invited to your payment page options by a link you send to them via email). We recommend you add the <checkoutURL>, in the URL parameter of your HPP URL. The <checkoutURL> must be your domain name.

Disable Google Pay (HPP payments only)

If you do not want to take payments from Google Pay, follow the instructions in the WorldpayMAI guideto disable it.

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

A list of links to Worldpay and Google Pay resources.


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