{"id":15029101,"url":"https://github.com/serso/android-checkout","last_synced_at":"2025-04-08T02:42:40.731Z","repository":{"id":19109254,"uuid":"22337952","full_name":"serso/android-checkout","owner":"serso","description":"Library for Android In-App Billing (Version 3+)","archived":false,"fork":false,"pushed_at":"2024-01-26T14:32:56.000Z","size":2196,"stargazers_count":1013,"open_issues_count":0,"forks_count":167,"subscribers_count":45,"default_branch":"master","last_synced_at":"2025-04-01T01:42:21.140Z","etag":null,"topics":["android","billing","billing-api","deprecated","obsolete","purchase"],"latest_commit_sha":null,"homepage":"","language":"Java","has_issues":false,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/serso.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2014-07-28T09:48:40.000Z","updated_at":"2025-01-22T07:37:43.000Z","dependencies_parsed_at":"2024-01-07T06:49:54.352Z","dependency_job_id":"e35e830f-b2ca-47ca-828a-ff72f1b3920d","html_url":"https://github.com/serso/android-checkout","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/serso%2Fandroid-checkout","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/serso%2Fandroid-checkout/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/serso%2Fandroid-checkout/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/serso%2Fandroid-checkout/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/serso","download_url":"https://codeload.github.com/serso/android-checkout/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247767232,"owners_count":20992538,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["android","billing","billing-api","deprecated","obsolete","purchase"],"created_at":"2024-09-24T20:09:43.976Z","updated_at":"2025-04-08T02:42:40.712Z","avatar_url":"https://github.com/serso.png","language":"Java","funding_links":[],"categories":["Libs","Uncategorized","SDK"],"sub_categories":["\u003cA NAME=\"SDK\"\u003e\u003c/A\u003eSDK","Uncategorized"],"readme":"# [Deprecated] Checkout (Android In-App Billing Library)\n\nThe libary is not actively maintained and no new verions are planned in the future. Use [the official billing libary](https://developer.android.com/google/play/billing/integrate) instead.\n\n## Description\n\n\u003cimg src=\"https://github.com/serso/android-checkout/blob/master/app/misc/res/logo256x256.png\" align=\"right\" /\u003e\n\n**Checkout** is an implementation of [Android In-App Billing API (v3+)](http://developer.android.com/google/play/billing/api.html).\nIts main goal is to make integration of in-app products as simple and\nstraightforward as possible: developers should not spend much time on\nimplementing boring In-App Billing API but should focus on more important\nthings - their apps. With this in mind, the library was designed to be\nfast, flexible and secure.\n\n**Current version:** 1.3.2\n\n### Why?\n\n**Checkout** solves common problems that developers face while working \nwith billing on Android, such as:\n- How to cancel all billing requests when Activity is destroyed?\n- How to query purchase information in the background?\n  See also [Querying for Items Available for Purchase](http://developer.android.com/google/play/billing/billing_integrate.html#QueryDetails)\n- How to verify a purchase?\n  See also [Security And Design](http://developer.android.com/google/play/billing/billing_best_practices.html)\n- How to load all the purchases using `continuationToken` or SKU\n  details (one request is limited by 20 items)?\n- How to add billing with a minimum amount of boilerplate code?\n\n**Checkout** can be used with any dependency injection framework or\nwithout it. It has a clear distinction of a functionality available in\ndifferent contexts: purchase can be done only from `Activity` while\nSKU information can be loaded in `Service` or `Application`.\nMoreover, it has a good test coverage and is continuously build on Travis\nCI:  [![Build Status](https://travis-ci.org/serso/android-checkout.svg)](https://travis-ci.org/serso/android-checkout)\n\n## Getting started\n\n### Setup\n\n- Gradle/Android Studio in `build.gradle`:\n```groovy\nimplementation 'org.solovyev.android:checkout:1.3.2'\n```\n**Note:** if you get the following warning\n\u003e Conflict with dependency 'com.google.code.findbugs:jsr305'. Resolved versions for app (a.b.c) and test app (x.y.z) differ.\n\nyou should change the dependencies of `com.android.support.test.espresso:espresso-core` to\n```groovy\nandroidTestImplementation('com.android.support.test.espresso:espresso-core:x.y.z', {\n    // use version of jsr305 provided by Checkout\n    exclude group: 'com.google.code.findbugs', module: 'jsr305'\n})\n```\nSee [Android Studio](http://g.co/androidstudio/app-test-app-conflict) and [Gradle](https://docs.gradle.org/current/dsl/org.gradle.api.artifacts.ResolutionStrategy.html) documentation for details.\n- Maven in `pom.xml`:\n```xml\n\u003cdependency\u003e\n    \u003cgroupId\u003eorg.solovyev.android\u003c/groupId\u003e\n    \u003cartifactId\u003echeckout\u003c/artifactId\u003e\n    \u003cversion\u003e1.3.2\u003c/version\u003e\n    \u003ctype\u003eaar\u003c/type\u003e\n\u003c/dependency\u003e\n```\n- Download sources from github and either copy them to your project or import them as a project dependency\n- Download artifacts from the [repository](https://oss.sonatype.org/content/repositories/releases/org/solovyev/android/checkout/)\n\n### Tutorial\n\nA tutorial for the sample app is available on [Medium](https://medium.com/@se.solovyev/implementing-in-app-billing-in-android-4896232c7d6b).\nTake a look if you prefer step-by-step guides over documentation.\n\n### Example\n\nSay there is an app that contains one in-app product with \"sku_01\" id.\nThen `Application` class might look like this:\n```java\npublic class MyApplication extends Application {\n\n    private static MyApplication sInstance;\n\n    private final Billing mBilling = new Billing(this, new Billing.DefaultConfiguration() {\n        @Override\n        public String getPublicKey() {\n            return \"Your public key, don't forget about encryption\";\n        }\n    });\n\n    public MyApplication() {\n        sInstance = this;\n    }\n\n    public static MyApplication get() {\n        return sInstance;\n    }\n\n    public Billing getBilling() {\n        return mBilling;\n    }\n}\n```\nAnd `Activity` class like this:\n```java\npublic class MyActivity extends Activity implements View.OnClickListener {\n\n    private class PurchaseListener extends EmptyRequestListener\u003cPurchase\u003e {\n        @Override\n        public void onSuccess(Purchase purchase) {\n           // here you can process the loaded purchase\n        }\n        \n        @Override\n        public void onError(int response, Exception e) {\n            // handle errors here\n        }\n    }\n\n    private class InventoryCallback implements Inventory.Callback {\n        @Override\n        public void onLoaded(Inventory.Products products) {\n            // your code here\n        }\n    }\n\n    private final ActivityCheckout mCheckout = Checkout.forActivity(this, MyApplication.get().getBilling());\n    private Inventory mInventory;\n\n    @Override\n    protected void onCreate(Bundle savedInstanceState) {\n        super.onCreate(savedInstanceState);\n        mCheckout.start();\n\n        mCheckout.createPurchaseFlow(new PurchaseListener());\n\n        mInventory = mCheckout.makeInventory();\n        mInventory.load(Inventory.Request.create()\n                .loadAllPurchases()\n                .loadSkus(ProductTypes.IN_APP, \"sku_01\"), new InventoryCallback());\n    }\n\n    @Override\n    protected void onDestroy() {\n        mCheckout.stop();\n        super.onDestroy();\n    }\n\n    @Override\n    protected void onActivityResult(int requestCode, int resultCode, Intent data) {\n        super.onActivityResult(requestCode, resultCode, data);\n        mCheckout.onActivityResult(requestCode, resultCode, data);\n    }\n\n    @Override\n    public void onClick(View v) {\n        mCheckout.whenReady(new Checkout.EmptyListener() {\n            @Override\n            public void onReady(BillingRequests requests) {\n                requests.purchase(ProductTypes.IN_APP, \"sku_01\", null, mCheckout.getPurchaseFlow());\n            }\n        });\n    }\n}\n```\n\n## Advanced usage\n\n### Samples\n\nA sample app is available on [Google Play](https://play.google.com/store/apps/details?id=org.solovyev.android.checkout.app) ([source code](https://github.com/serso/android-checkout/tree/master/app)).\nThere is also a tutorial for it on [Medium](https://medium.com/@se.solovyev/implementing-in-app-billing-in-android-4896232c7d6b).\n\n### Building from the sources\n\n**Checkout** is built by Gradle. The project structure and build procedure\nare standard for Android libraries. An environmental variable ANDROID_HOME\nmust be set before building and should point to Android SDK installation\nfolder (f.e. /opt/android/sdk).\nPlease refer to [Gradle User Guide](http://tools.android.com/tech-docs/new-build-system/user-guide) for more information about the building.\n\n### Classes overview\n\n**Checkout** contains three main classes: [Billing](https://github.com/serso/android-checkout/blob/master/lib/src/main/java/org/solovyev/android/checkout/Billing.java), [Checkout](https://github.com/serso/android-checkout/blob/master/lib/src/main/java/org/solovyev/android/checkout/Checkout.java) and [Inventory](https://github.com/serso/android-checkout/blob/master/lib/src/main/java/org/solovyev/android/checkout/Inventory.java).\n\n**Billing** is a core class of **Checkout**'s implementation of the\nbilling API. It is responsible for:\n- connecting and disconnecting to the [billing service](https://github.com/serso/android-checkout/blob/master/lib/src/main/aidl/com/android/vending/billing/IInAppBillingService.aidl)\n- performing [billing requests](https://github.com/serso/android-checkout/blob/master/lib/src/main/java/org/solovyev/android/checkout/BillingRequests.java)\n- caching the requests results\n- creating [Checkout](https://github.com/serso/android-checkout/blob/master/lib/src/main/java/org/solovyev/android/checkout/Checkout.java) objects\n- logging\n\nOnly one instance of **Billing** should be used in the app in order to\navoid multiple connections to the billing service. Though this class\nmight be used directly it's easier to work with [Checkout](https://github.com/serso/android-checkout/blob/master/lib/src/main/java/org/solovyev/android/checkout/Checkout.java)\ninstead.\n\n**Checkout** is a middle tier of the library. It uses **Billing** in a\ncertain context, e.g. in `Application`, `Activity` or `Service`,\nchecks whether billing is supported and executes the requests. [ActivityCheckout](https://github.com/serso/android-checkout/blob/master/lib/src/main/java/org/solovyev/android/checkout/ActivityCheckout.java)\nis a subclass capable of purchasing items.\n\n**Inventory** loads information about products, SKUs and purchases. Its\nlifecycle is bound to the lifecycle of **Checkout** in which it was created.\n\n### Purchase verification\n\nBy default, **Checkout** uses simple purchase verification algorithm (see\n[DefaultPurchaseVerifier](https://github.com/serso/android-checkout/blob/master/lib/src/main/java/org/solovyev/android/checkout/DefaultPurchaseVerifier.java)). As explained in [Android documentation](http://developer.android.com/google/play/billing/billing_best_practices.html#sign)\nit's better to verify purchases on a remote server. **Checkout** allows\nyou to provide your own [PurchaseVerifier](https://github.com/serso/android-checkout/blob/master/lib/src/main/java/org/solovyev/android/checkout/PurchaseVerifier.java) via `Billing.Configuration#getPurchaseVerifier`.\n[BasePurchaseVerifier](https://github.com/serso/android-checkout/blob/master/lib/src/main/java/org/solovyev/android/checkout/BasePurchaseVerifier.java)  can be used as a base class for purchase verifiers that\nshould be executed on a background thread.\n\n### Proguard\n\nLibrary's proguard rules are automatically added to the app project by\nGradle. You can declare them explicitly by copying the contents of [proguard-rules.txt](https://github.com/serso/android-checkout/blob/master/lib/proguard-rules.txt)\nto your proguard configuration.\n\n## License\n\nCopyright 2016 serso aka se.solovyev\n\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License.\nYou may obtain a copy of the License at\n\nhttp://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\nlimitations under the License.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fserso%2Fandroid-checkout","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fserso%2Fandroid-checkout","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fserso%2Fandroid-checkout/lists"}