Judopay Documentation

Android

Configuring Google Pay™ for Android

Prerequisite

  • You have set up your Google Pay™ payments profile.

    For more details, see Create a Payments Profile..

  • You have imported the following models:

import com.judopay.model.googlepay.GooglePayAddressFormat
import com.judopay.model.googlepay.GooglePayBillingAddressParameters
import com.judopay.model.GooglePayConfiguration
import com.judopay.model.googlepay.GooglePayEnvironment
import com.judopay.model.googlepay.GooglePayShippingAddressParameters

Creating the Google Pay™ Configuration

To create the Google Pay™ configuration:

  1. Set the required properties using the prerequisite imported models.

  2. Set some additional optional properties to customise Google Pay™:

var billingAddressParams = GooglePayBillingAddressParameters(
    format = GooglePayAddressFormat.MIN,
    phoneNumberRequired = true
)

var shippingAddressParams = GooglePayShippingAddressParameters(
    phoneNumberRequired = true
)

var googlePayConfiguration = GooglePayConfiguration.Builder()
              .setTransactionCountryCode("GB")
              .setEnvironment(GooglePayEnvironment.TEST)
              .setIsEmailRequired(true)
              .setIsBillingAddressRequired(true)
              .setBillingAddressParameters(billingAddressParams)
              .setIsShippingAddressRequired(true)
              .setShippingAddressParameters(shippingAddressParams)
              .build()

Field

Description

setTransactionCountryCode

Required

Sets the transaction ISO-3166 country code.

setEnvironment

Required

Sets the Google Pay™ environment to either:

  • TEST

  • PRODUCTION

    Note: In order to go-live you will need to have set up your Google Pay™ API merchant live account.

setIsEmailRequired

Required

Sets the option for the consumer to provide their email address.

setBillingAddressParameters

Required

Sets the option for the consumer to provide their billing information.

setBillingAddressParameters

Optional

Sets the billing address format.

SetIsShippingAddressRequired

Required

Sets the option for the consumer to provide their shipping information.

setShippingAddressParameters

Optional

Sets the shipping address format.

Caution

Although setting the billing and shipping parameters is optional, they must be provided if the billing and shipping requirements are set to true.

Making a Google Pay™ Transaction

Prerequisite

You have set up the GooglePayConfiguration.

 

To make a Google Pay™ transaction:

  1. Add the setGooglePayConfiguration method to the Judo builder

  2. Set the PaymentWidgetType to: 

    1. GOOGLE_PAY or

    2. PRE_AUTH_GOOGLE_PAY

  3. Start the Judo activity:

val judo = Judo.Builder(PaymentWidgetType.GOOGLE_PAY)
              ...
              .setGooglePayConfiguration(googlePayConfiguration)
              .build()

val intent = Intent(this, JudoActivity::class.java);
intent.putExtra(Judo.JUDO_OPTIONS, judo);
startActivityForResult(intent, PAYMENT_REQUEST_CODE);