Pay with Google

Pay with Google

The Pay with Google offers a quick and easy path to enable secure, one touch payments in your app.
This guide explains how to process payments with our SDK.


Open the build.gradle file in the app module and add the following to the dependencies block:

dependencies {
    compile ''
    compile ''
    compile ''

NOTE: The device must have Google Play Services version 11.4.x or newer installed.

You can find detailed instructions in the Google Payment API.

Adding the Pay with Google to your app must be done in one of two ways, depending on whether you are using the Ready-to-Use UI or the SDK & Your Own UI. These two ways are covered in the sections below. Please follow the instructions relevant to the approach you have chosen.

Ready-to-Use UI

Create the CheckoutSettings, and add the PAYWITHGOOGLE payment brand:

Set<String> paymentBrands = new HashSet<String>();

CheckoutSettings checkoutSettings = new CheckoutSettings(checkoutId, paymentBrands, Connect.ProviderMode.TEST);

Set the entity id, allowed payment methods and allowed card networks:

checkoutSettings.setPayWithGoogleAllowedPaymentMethods(new Integer[] {
checkoutSettings.setPayWithGoogleAllowedCardNetworks(new Integer[] {

If you are using CheckoutActivity, set up the Intent and start the activity:

Intent intent = checkoutSettings.createCheckoutActivityIntent(this);

startActivityForResult(intent, CheckoutActivity.REQUEST_CODE_CHECKOUT);

If you integrate the Pay with Google using our drop-in buttons, set the PAYWITHGOOGLE payment brand.

PaymentButtonFragment paymentButtonFragment = new PaymentButtonFragment();


SDK & Your Own UI

Follow this tutorial to integrate the Pay with Google into your UI. To make a transaction create the PayWithGooglePaymentParams with a received token:

PaymentParams paymentParams = new PayWithGooglePaymentParams(checkoutId, token);

And submit the transaction:

Transaction transaction = null;

try {
    transaction = new Transaction(paymentParams);
} catch (PaymentException ee) {
    /* error occurred */