Git Product home page Git Product logo

code4rox / google-iap Goto Github PK

View Code? Open in Web Editor NEW

This project forked from akshaaatt/google-iap

0.0 0.0 0.0 10.58 MB

Android Library for easing Google Play Billing to your apps with support for Subscriptions, Non-Consumable and Consumable Purchases with a beautiful sample app.

Home Page: https://play.google.com/store/apps/details?id=com.redalck.gameone

License: GNU General Public License v3.0

Java 9.25% Kotlin 90.75%

google-iap's Introduction

Google-IAP (Play Billing Library Version 6.0.1)

GitHub issues GitHub last commit GitHub issues GitHub pull requests

FeaturesDevelopmentUsageLicenseContribution


Google-IAP


ezgif-com-gif-maker-3.gif

IAP is an Android library to handle In-App purchases with minimal code.

Features

  • Written in Kotlin
  • No boilerplate code
  • Easy initialization
  • Supports InApp & Subscription products
  • Simple configuration for consumable products

Gradle Dependency

  • Add the JitPack repository to your project's build.gradle file
allprojects {
    repositories {
        ...
        maven { url 'https://jitpack.io' }
    }
}
  • Add the dependency in your app's build.gradle file
dependencies {
    implementation 'com.github.akshaaatt:Google-IAP:1.5.0'
}

Development

  • Prerequisite: Latest version of the Android Studio and SDKs on your pc.
  • Clone this repository.
  • Use the gradlew build command to build the project directly or use the IDE to run the project to your phone or the emulator.

Usage

Establishing connection with Play console

val iapConnector = IapConnector(
    context = this, // activity / context
    nonConsumableKeys = nonConsumablesList, // pass the list of non-consumables
    consumableKeys = consumablesList, // pass the list of consumables
    subscriptionKeys = subsList, // pass the list of subscriptions
    key = "LICENSE KEY", // pass your app's license key
    enableLogging = true // to enable / disable logging
)

Receiving events

iapConnector.addPurchaseListener(object : PurchaseServiceListener {
    override fun onPricesUpdated(iapKeyPrices: Map<String, DataWrappers.SkuDetails>) {
        // list of available products will be received here, so you can update UI with prices if needed
    }
    
    override fun onProductPurchased(purchaseInfo: DataWrappers.PurchaseInfo) {
        // will be triggered whenever purchase succeeded
    }
    
    override fun onProductRestored(purchaseInfo: DataWrappers.PurchaseInfo) {
        // will be triggered fetching owned products using IapConnector
    }
})

iapConnector.addSubscriptionListener(object : SubscriptionServiceListener {
    override fun onSubscriptionRestored(purchaseInfo: DataWrappers.PurchaseInfo) {
        // will be triggered upon fetching owned subscription upon initialization
    }
    
    override fun onSubscriptionPurchased(purchaseInfo: DataWrappers.PurchaseInfo) {
        // will be triggered whenever subscription succeeded
    }
    
    override fun onPricesUpdated(iapKeyPrices: Map<String, DataWrappers.SkuDetails>) {
        // list of available products will be received here, so you can update UI with prices if needed
    }
})

Making a purchase

iapConnector.purchase(this, "<sku>")

Making a subscription

iapConnector.susbcribe(this, "<sku>")

Removing a subscription

iapConnector.unsubscribe(this, "<sku>")

Sample App

  • Add your products to the developer console

  • Replace the key with your App's License Key

Apps Using this Library

License

This Project is licensed under the GPL version 3 or later.

Contribution

You are most welcome to contribute to this project!

google-iap's People

Contributors

adrcotfas avatar akshaaatt avatar amarilindra avatar artsimonyan23 avatar dependabot[bot] avatar kf99916 avatar mrz07 avatar skaldebane 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.