An Android library for new in-app-purchase api
Check out the app directory for a sample app using this library
Root build.gradle
allprojects {
repositories {
...
mavenCentral()
}
}
App build.gradle
dependencies {
implementation 'vn.com.extremevn:ebilling:1.1.0'
...
}
For launch purchase flow, must use
class MainActivity : AppCompatActivity() {
lateinit var billingProcessor: BillingProcessor
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
billingProcessor = Billing.createFor(this)
// Other code
}
}
If don't need to launch purchase flow, can use
class SampleService : Service() {
lateinit var billingProcessor: BillingProcessor
override fun onCreate() {
super.onCreate()
billingProcessor = Billing.createFor(this)
// Other code
}
}
Then we can use billing api func similar to android in-app-billing api. For example
val params =
SkuDetailsParams.newBuilder()
.setType(BillingClient.SkuType.INAPP)
.setSkusList(
listOf("your.product.id")
).build()
billingProcessor.getSkuDetails(
params,
object : RequestListener<List<SkuDetails>> {
override fun onSuccess(result: List<SkuDetails>) {
Timber.tag("GET_SKU").i("$result")
}
override fun onError(response: Int, e: Exception) {
Timber.tag("GET_SKU").e(e, "code: $response")
}
}
)
If there is specific issues, bugs, or feature requests please report in our mailing list
- Justin Lewis (Maintainer)