Prerequisites
Before you get started, review the following prerequisites:
- Install the Google Play services version 18.1.1 or greater.
- Install the Google Pay app and add a payment method.
- Add a payment method to Google.
- Adhere to our Google Pay API Acceptable Use Policy and the Google Play developer policy.
Configure your project
If you don't already have Android Studio, download and install
Android Studio.
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
Each version provided is the minimum version required for the most recent version of the
Google Pay API library. Your app may choose a dependency greater than the value above.
For current Google Pay API version information, see
Set Up Google Play services.
For current information about support libraries, see
Support Library Setup. To enable Google Pay in your app, you need to add the following Google Pay API
meta-data element
to the
Add dependencies
build.gradle
file in the app module and add the following to the dependencies block:
dependencies {
implementation 'com.google.android.gms:play-services-wallet:18.1.1'
implementation 'com.android.support:appcompat-v7:24.1.1'
}
Modify your Manifest
<application>
element of your project's
AndroidManifest.xml
file.
<meta-data
android:name="com.google.android.gms.wallet.api.enabled"
android:value="true" />