pay-me

Build Status

the place burned down? lightning struck? slow business?

An Android library for handling In-App-Billing V3 (IABv3), based on Google's marketbilling sample code. The goal of this project is to build a reliable and tested library which can easily be included as an apklib in your (Maven based) projects.

Google's sample code has been refactored and made testable - at the moment there are over 100 unit tests covering most of the code base. It is currently used in the 1.5.x version of SMS Backup+.

usage

Install the apklib to your local maven repository (it has not been published yet).

$ git clone https://github.com/jberkel/pay-me.git
$ cd pay-me && mvn install

Add a maven dependency in your main project:

<dependency>
    <groupId>com.github.jberkel.pay.me</groupId>
    <artifactId>library</artifactId>
    <version>0.0.3</version>
    <type>apklib</type>
</dependency>

Instantiate and use the IabHelper in your activity:

@Override public void onCreate(Bundle bundle) {
    mIabHelper = new IabHelper(this, "Base64EncodedPublicKey");
    mIabHelper.startSetup(new OnIabSetupFinishedListener() {
        public void onIabSetupFinished(IabResult result) {
          if (result.isSuccess()) {
              // helper is ready to use
              mIabHelper.launchPurchaseFlow(this,
                 "android.test.purchased",
                  ItemType.IN_APP,
                  0,
                  new OnIabPurchaseFinishedListener() {
                     public void onIabPurchaseFinished(IabResult result, Purchase purchase) {
                        // handle purchase result
                     }
                  }, null
              );
          }
        }
    });
}

@Override protected void onActivityResult(int requestCode, int resultCode, Intent data) {
    mIabHelper.handleActivityResult(requestCode, resultCode, data);
}

##License

This application is released under the terms of the Apache License, Version 2.0.

Join India's largest learning revolution
Free Video Tutorials
Learn Programming
Learning is a journey, let's learn together

MindOrks Newsletter
100,000+ Subscribers
A free weekly newsletter that comes with the latest Android articles, open source projects, events and hot discussions.

Subscribe Now

Featured Blogs

Our Team

MindOrks is Certainly one of the best online blog to stay on top of all the Android development news, coding and design patterns. Finally a blog I can count on to keep myself updated with latest and greatest things happening in Android world.

Vipul Shah
Android Developer
Microsoft

OUR LEARNERS WORK AT