Set up Google Pay API

Before you begin

To prepare your app, complete the steps in the following sections.

App prerequisites

Make sure that your app's build file uses the following values:

  • A minSdkVersion of 19 or higher
  • A compileSdkVersion of 28 or higher

Set up your app in your Google Pay account

Configure your app

To configure your app, complete the steps in the following sections.

App dependencies

In your project-level build.gradle file, include Google's Maven repository and Maven central repository in both your buildscript and allprojects sections:

buildscript {
  repositories {
    google()
    mavenCentral()
  }
}

allprojects {
  repositories {
    google()
    mavenCentral()
  }
}
    

Add the Google Play services dependency for the Google Pay API to your module's Gradle build file, which is commonly app/build.gradle:

dependencies {
  implementation 'com.google.android.gms:play-services-wallet:18.1.3'
}
    

Modify your manifest

To enable Google Pay in your app, you need to add the following Google Pay API meta-data element to the <application> element of your project's AndroidManifest.xml file.

  
<meta-data
  android:name="com.google.android.gms.wallet.api.enabled"
  android:value="true" />