• Stars
    star
    242
  • Rank 167,048 (Top 4 %)
  • Language
    Kotlin
  • License
    GNU General Publi...
  • Created almost 4 years ago
  • Updated 4 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

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

Google-IAP (Play Billing Library Version 6.0.0)

GitHub issues GitHub last commit GitHub issues GitHub pull requests

Features • Development • Usage • License • Contribution


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.4.2'
}

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!

More Repositories

1

Sliding-Carousel

Android Library for easing Slider insertion to your apps with support for Images with a beautiful sample app.
Kotlin
35
star
2

Cropper

Android Library for cropping an image at ease.
Kotlin
30
star
3

Media-Picker

Android Library for easing Media Selection to your apps with support for Images and Videos with a beautiful sample app.
Kotlin
27
star
4

Onboarding-Android

Android Library for easing up the onboarding process.
Kotlin
15
star
5

Dialogs-Android

Android Library to ease the initialization of Dialogs
Kotlin
8
star
6

Swarogya

Swarogya interfaces a smartphone application to a web based application that is handled by health professionals of hospitals.
JavaScript
8
star
7

Onboarding

Android Library for easing up the onboarding process.
Kotlin
7
star
8

musicbrainz-web-next

Web Application of MusicBrainz Revamp using Nextjs
JavaScript
7
star
9

Component-To-Image

React App for Downloading a Component as Image
JavaScript
5
star
10

Networking-Tools

Android app for testing out various networking capabilities
Kotlin
4
star
11

ExploreVision

VisionOS App for the Vision Pro
Swift
3
star
12

Earth-Viewer

Android app of Earth Viewer
Kotlin
2
star
13

Country-Picker

Android Library that can be used to show a country picker.
Kotlin
2
star
14

Share-Android

Android Library for easing sharing text and media to other apps.
Kotlin
2
star
15

BottomSheet-Gallery

Android Library to visualize the gallery through a bottom sheet.
Kotlin
2
star
16

example-ios-app

A basic iOS App with Clean Architecture
Swift
2
star
17

Attributions

Android library to ease presenting the libraries and OSS software used in the project
Kotlin
1
star
18

Advent-Of-Code-2021

Advent of Code 2021
Kotlin
1
star
19

AWS-S3-File-Transfer

Android SDK simplifying upload and download from AWS S3.
Kotlin
1
star
20

Confetti

Android Library of Confetti remastered.
Kotlin
1
star
21

Tagger

Android Library for Audio File Tagging
Java
1
star
22

three-cover

3-Dimensional covers using Three.js
TypeScript
1
star
23

UnimateR

UnimateR - Prepare, Calculate And Stay Updated
Kotlin
1
star
24

musicbrainz-web

Web App of MusicBrainz
JavaScript
1
star
25

Resume-Generator

NextJs Resume Generator
TypeScript
1
star
26

Pytorch-ObjectDetection-Android

Android app using pytorch for object detection.
Kotlin
1
star
27

Pager

Android App of Pager
Kotlin
1
star
28

Quanage-Server

Flask Server of Quanage
Python
1
star
29

Logger-Android

Android Library for easing logging and to store loges in Files
Java
1
star
30

Repurpose-Android

Android App of Repurpose
Kotlin
1
star
31

SVG-Loader-Android

SVG Loader and Renderer for Android
Java
1
star
32

ARCore-3D-Placing

Android app of 3D placing sample
Kotlin
1
star