Click here to search the entire website

Pay with Google

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

Note:  The web integration to Pay with Google is coming soon, and we will update this guide when it is ready.

How it works

  1. You request the encrypted payload from your app

  2. Pay with Google 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:

  • A Direct integration to Worldpay

  • A Google account

  • Worldpay to enable Pay with Google on your account

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

Merchant ID

When Pay with Google is enabled on your Worldpay account, you can generate your own Merchant ID using the Worldpay MAI.

Set up Pay with Google

For detailed instructions on how to configure Pay with Google for in-app payments, see:

Integrate with Pay with Google

See the Google Payment API guide -

Set the allowedCardNetworks property

Worldpay only supports Pay with Google 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 with Pay with Google to 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">

      <description>PayWithGoogle test order</description>

      <amount value="100" currencyCode="GBP" exponent="2"/>

















Example payload

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







The response message is the same as our standard XML responses.


Pay with Google 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.

Google provide further testing details at:

Useful links


Google Payment API - Guides and Tutorials:

Software development links

Android Studio:

Android Tutorial:

Android Test and Deploy:

Android Developer Support library:

Google's GitHub sample: