Payment-method icon

Google Pay Drop-in integration

Add Google Pay to an existing Drop-in integration.

Our Android Drop-in renders Google Pay in your payment form. When shoppers select Google Pay, Drop-in presents the Google Pay payment sheet where shoppers choose a card they want to use. If shoppers select a card that requires 3D Secure authentication, Drop-in also handles redirecting shoppers to another website to complete the verification.

Requirements

Requirement Description
Integration type Make sure that you have an existing Drop-in integration.
Setup steps Before you begin: .

Show Google Pay in your payment form

Drop-in uses the countryCode and the amount.currency from your /paymentMethods request to show the available payment methods to your shopper. From your server, make a /paymentMethods request specifying:

  • countryCode: Country or region where Google Pay is supported. For example, NL.
  • amount.currency: Any supported currency. For example, EUR.

Optional configuration

When creating an instance of Drop-in, you can optionally include a GooglePayConfiguration object to add custom configuration for Google Pay in your payment form.

val googlePayConfig = GooglePayConfiguration.Builder(YourContext, "YOUR_CLIENT_KEY")
   .setAmount(amount)
   // When you are ready to accept live payments, change the value to one of our live environments (for example, Environment.LIVE).
   .setEnvironment(Environment.TEST)
   .build()

val dropInConfiguration =
   DropInConfiguration.Builder(YourContext, YourDropInService::class.java, "YOUR_CLIENT_KEY")
   // When you are ready to accept live payments, change the value to one of our live environments (for example, Environment.LIVE).
   .setEnvironment(Environment.TEST)
   // Required for versions earlier than v4.5.0. When you are ready to accept live payments, change the value to ENVIRONMENT_PRODUCTION.
   .setGooglePayEnvironment(WalletConstants.ENVIRONMENT_TEST)
   .addGooglePayConfiguration(googlePayConfig)
   .build()

Make a payment

When the shopper proceeds to pay, Drop-in returns the paymentComponentData.paymentMethod.

  1. Pass the paymentComponentData.paymentMethod to your server.

  2. From your server, make a /payments request, specifying:

    • paymentMethod: The paymentComponentData.paymentMethod from your client app.
    • browserInfo: Required if you want to trigger 3D Secure authentication.
    • returnURL: URL where the shopper will be redirected back to after completing a 3D Secure authentication. The returnUrl can have a maximum of 1024 characters. Get this URL from the Component in the RedirectComponent.getReturnUrl(context).