Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/itznotabug/checkoutverifier

Verify your In-App Purchase receipts & protect your Apps from hacking, patching used by Piracy Apps like Lucky Patcher.
https://github.com/itznotabug/checkoutverifier

android android-iap android-in-app-billing android-in-app-purchase android-protect-apps android-protection android-security

Last synced: about 1 month ago
JSON representation

Verify your In-App Purchase receipts & protect your Apps from hacking, patching used by Piracy Apps like Lucky Patcher.

Awesome Lists containing this project

README

        

# CheckoutVerifier



[![Codacy Badge](https://app.codacy.com/project/badge/Grade/bb126216417b45668b81e08090d2d081)](https://www.codacy.com/gh/ItzNotABug/CheckoutVerifier/dashboard?utm_source=github.com&utm_medium=referral&utm_content=ItzNotABug/CheckoutVerifier&utm_campaign=Badge_Grade)

CheckoutVerifier helps you Verify your In-App Purchase receipts & protect your Apps from hacking, patching used by Piracy Apps like Lucky Patcher.

Since I was using these classes in every project, the copy / pasting of classes was annoying so thought of releasing it as a library which might be of help to others too!

## How does it work?
Well, the library sends the Signed Json Response & Signature that you receive after a purchase is completed on a specified server url where it checks the signature of that response data with your BASE64 Key provided to you in your Developer Console.

## Set Up
#### * Get Licensing API Key
Navigate to Developer Console & Select your App.

Go to Development Tools > Services & API.

Copy the BASE64 Licensing Key

#### * Creating a Verifying PHP File
Just a create a File & name it as `verify.php` or anything you want.

Paste the following code in it & Upload it to your server.

```php

```

#### * Implementing Library (Gradle)
Note: Add `mavenCentral()` in `repositories` block.

```gradle
dependencies {
// CheckoutVerifier now internally uses Kotlin Coroutines.
implementation 'com.lazygeniouz:checkout-verifier:$library_version'
}
```

#### * CheckoutVerifier
Just pass on the required `PurchaseBundle` in the Constructor & call `authenticate();`

The `authenticate()` returns a `Result` object.



If the connection to the server was successful & a result was returned,

`CompletionResult(isVerified: Boolean)` is returned,

`ErrorResult(exception: Exception)` otherwise.


Example:
```kotlin
yourScope.launch {
val purchaseBundle = PurchaseBundle(url, jsonResponse, signature)
when (val result = CheckoutVerifier(purchaseBundle).authenticate()) {
is CompletionResult -> {
val verified = result.isVerified
// Do something
}
is ErrorResult -> Log.d(TAG, result.exception.message)
}
}
```