Are you interested in attending a Google Pay launchathon in your city? Let us know!

Set up Google Pay API

Before you get started

Before you get started, review the following prerequisites:

Configure your project

If you don't already have Android Studio, download and install Android Studio.

Add dependencies

The Google Pay API is part of Google Play services, so you only need to import the Google Play services library to get everything you need. Or, you can choose the APIs you want to compile yourself.

To import the entire Google Play services library, see Set Up Google Play services.

If you prefer to selectively compile only the APIs you need, then open the build.gradle file in the app module and add the following to the dependencies block:

dependencies {
    compile 'com.google.android.gms:play-services-wallet:11.4.0'
    compile 'com.android.support:support-v4:24.1.1'
    compile 'com.android.support:appcompat-v7:24.1.1'
}

For current Google Pay API version information, see Setting Up Google Play services. For current information about support libraries, see Support Library Setup.

Modify your Manifest

To enable Google Pay in your app, you need to add the following Google Pay API meta-data to the <application> tag of your AndroidManifest.xml:

<application>
  ...
  <!-- Enables the Google Pay API -->
  <meta-data
    android:name="com.google.android.gms.wallet.api.enabled"
    android:value="true" />
</application>

发送以下问题的反馈:

此网页
Google Pay API