GithubHelp home page GithubHelp logo

google_iap's Introduction

Installation:

// add the JitPack repository to your build file:

allprojects {
repositories {
  ...
  maven { url 'https://jitpack.io' }
  }
}

// add the dependency:

dependencies {
  implementation 'com.github.congle7997:GoogleIAP:Tag'
}

Consumables:

// purchase:

List<String> listSkuStoreInApp = new ArrayList<>();
listSkuStoreInApp.add("YOUR_KEY_INAPP_FROM_STORE");
BillingInApp billingInApp = new BillingInApp(MainActivity.this, listSkuStoreInApp, new CallBackBilling() {
   @Override
   public void onPurchase() {
       Log.d(TAG, "onPurchase: ");
   }

   @Override
   public void onNotPurchase() {
        Log.d(TAG, "onNotPurchase: ");
   }

   @Override
   public void onNotLogin() {
       Log.d(TAG, "onNotLogged: ");
   }
});
billingInApp.purchase("KEY_INAPP_NEED_PURCHASE");

// check purchase:

List<String> listCheckInApp = new ArrayList<>();
listCheckInApp.add("KEY_NEED_CHECK");
BillingInApp billingInApp = new BillingInApp(MainActivity.this, listCheckInApp);
billingInApp.checkPurchase(listCheckInApp, new CallBackBilling() {
   @Override
   public void onPurchase() {
       Log.d(TAG, "onPurchase: ");
   }

   @Override
   public void onNotPurchase() {
       Log.d(TAG, "onNotPurchase: ");
   }

   @Override
   public void onNotLogin() {
       Log.d(TAG, "onNotLogged: ");
   }
});

Not-consumables:

// purchase:

List<String> listSkuStoreSubs = new ArrayList<>();
listSkuStoreSubs.add("YOUR_KEY_SUBS_FROM_STORE");
BillingSubs billingSubs = new BillingSubs(this, listSkuStoreSubs, new CallBackBilling() {
    @Override
    public void onPurchase() {
      Log.d(TAG, "onPurchase: ");
    }

    @Override
    public void onNotPurchase() {
      Log.d(TAG, "onNotPurchase: ");
    }

    @Override
    public void onNotLogin() {
      Log.d(TAG, "onNotLogin: ");
    }
 });
billingSubs.purchase("KEY_SUBS_NEED_PURCHASE");

// check purchase:

List<String> listCheckSubs = new ArrayList<>();
listCheckSubs.add("KEY_NEED_CHECK");
BillingSubs billingSubs = new BillingSubs(this, listCheckSubs);
billingSubs.checkPurchase(listCheckSubs, new CallBackBilling() {
     @Override
     public void onPurchase() {
         Log.d(TAG, "onPurchase: ");
     }

     @Override
     public void onNotPurchase() {
          Log.d(TAG, "onNotPurchase: ");;
     }

     @Override
     public void onNotLogin() {
        Log.d(TAG, "onNotPurchase: ");
    }
 });

If you need support, contact me: [email protected]

google_iap's People

Contributors

congle7997 avatar mcsong avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.