Many developers want to make money through their apps, but it's not always easy to deal with all the different types of payment methods. We launched the Google Play In-app Billing API v3 in 2013, helping developers offer in-app products and subscriptions within their apps. Year after year, we've added features to the API, like subscription renewal, upgrades and downgrades, free trials, introductory pricing, promotion codes, and more.
Based on your feedback, we’re pleased to announce the Play Billing Library - Developer Preview 1. This library aims to simplify the development process when it comes to billing, allowing you to focus your efforts on implementing logic specific to your app, such as application architecture and navigation structure. The library includes several convenient classes and features for you to use when integrating your Android apps with the In-app Billing API. The library also provides an abstraction layer on top of the Android Interface Definition Language (AIDL) service, making it easier for you to define the interface between your app and the In-app Billing API.
Easy to get started and easy to use
Starting with Play Billing Library Developer Preview release, the minimum
supported API level is Android 2.2 (API level 8), and the minimum supported
In-app Billing API is version 3.
In-app billing relies on the Google Play Store, which handles the communication
between your app and Google's Play billing service. To use Google Play billing
features, your app must request the com.android.vending.BILLING
permission in your AndroidManifest.xml
file.
To use the library, add the following dependency in yourbuild.gradle
file:
dependencies {
...
compile 'com.android.billingclient:billing:dp-1'
}
After this quick setup process, you're ready to start using the Play Billing
Library in your app and can connect to the In-app Billing API, query for
available products, start the purchase flow, and more.
Sample updated: Trivial Drive V2
With a new library comes a refreshed sample! To help you to understand how to
implement in-app billing in your app using the new Play Billing Library, we've
rewritten the href="https://github.com/googlesamples/android-play-billing/tree/master/TrivialDrive">Trivial
Drive sample from the ground up.
Since we released Trivial Drive back in 2013, many new features, devices, and
platforms have been added to the Android ecosystem. To reflect this evolution,
the href="https://github.com/googlesamples/android-play-billing/tree/master/TrivialDrive_v2">Trivial
Drive v2 sample now runs on Android TV and Android Wear.
Give it a try!
Before integrating within your app, you can try the Play Billing Library with
the codelab published during Google I/O 2017: href="https://codelabs.developers.google.com/codelabs/play-billing-codelab">Buy
and Subscribe: Monetize your app on Google Play.
In this codelab, you will start with a simplified version of Trivial Drive V2
that lets users to "drive" and then you will add in-app billing to it. You'll
learn how to integrate purchases and subscriptions as well as the best practices
for developing reliable apps that handle purchases.
If you are looking for a step-by-step guide about how to sell in-app products
from your app using the Play Billing Library, check out our new href="http://developer.android.com/training/play-billing-library/index.html">training
class, explaining how to prepare your application, add products for
purchase, start purchase flow and much more.
We want your feedback
We look forward to hearing your feedback about this new library. Visit the href="https://developer.android.com/google/play/billing/billing_library.html">Play
Billing Library site,
the library href="https://developer.android.com/google/play/billing/billing_reference.html">reference,
and the new version of the href="https://github.com/googlesamples/android-play-billing/tree/master/TrivialDrive">Trivial
Drive sample. If you have issues or questions, file a href="https://issuetracker.google.com/issues/new?component=311487&template=1014446">bug
report on the href="https://issuetracker.google.com/issues?q=componentid:311487">Google Issue
Tracker, and for issues and suggestions on the sample, contact us on the href="https://github.com/googlesamples/android-play-billing/issues">Trivial
Drive issues page.
For technical questions on implementation, library usage, and best practices,
you can use the tags href="https://stackoverflow.com/questions/tagged/google-play">google-play
and href="https://stackoverflow.com/questions/tagged/play-billing-library">play-billing-library
on Stackoverflow or visit the href="https://plus.google.com/+AndroidDevelopers/palette">community pages on
our Google+ page.