GithubHelp home page GithubHelp logo

keepsafe / cashier Goto Github PK

View Code? Open in Web Editor NEW
25.0 15.0 8.0 729 KB

A Better Billing Provider for Android.

License: Apache License 2.0

Java 100.00%
billing in-app-billing android-library monetization android

cashier's People

Contributors

ajalt avatar brendan-keepsafe avatar emarc-m avatar nbarishok avatar philippb avatar tomasz-keepsafe avatar xiphirx avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

cashier's Issues

NPE When initializing IAB v3

Caused by java.lang.NullPointerException: Attempt to read from field 'int com.android.server.am.ProcessRecord.uid' on a null object reference
       at android.os.Parcel.readException(Parcel.java:1552)
       at android.os.Parcel.readException(Parcel.java:1499)
       at android.app.ActivityManagerProxy.bindService(ActivityManagerNative.java:3754)
       at android.app.ContextImpl.bindServiceCommon(ContextImpl.java:1970)
       at android.app.ContextImpl.bindService(ContextImpl.java:1939)
       at android.content.ContextWrapper.bindService(ContextWrapper.java:539)
       at com.getkeepsafe.cashier.iab.InAppBillingV3API.initialize(InAppBillingV3API.java:88)
       at com.getkeepsafe.cashier.iab.InAppBillingV3Vendor.initialize(InAppBillingV3Vendor.java:152)
       at com.getkeepsafe.cashier.Cashier.getInventory(Cashier.java:197)```

Handle test / sandbox purchases better

Test purchases don't have an orderId field, which ensures that there are no actual charges to user accounts.

This is confusing / problematic because Cashier doesnt relay this information. There should either be an option to allow sandbox testing where the order id field is not required, or it should be communicated that the purchase received was a test purchase.

Implement headless fragment to handle activity results

This will eliminate the need for activities to implement onActivityResult

The billing api communicates back to your app via activity results. So currently users of the library would need to implement handling logic in each activity they use the library with. Fragments also have the ability to handle activity results, and can be added / removed from any hosting activity. Fragments also do not need to display any UI, so the idea is to attach the fragment for the sole purpose of retrieving the result and passing it back to the library.

Dont require an Activity to create a Cashier instance, only require it for the purchase flow

The only need for an Activity over a regular Context is for the startIntentSenderForResult call only used while purchasing an item. The API shouldn't be handicapped by this, however. Removing the need for an Activity in each interaction with an instance of Cashier allows background/asynchronous product / inventory queries among other things that are not easily possible right now.

Add stubs module for test IAB classes.

The cashier-iab-debug module was added so that you can prevent debug activities from being included in the release APK. However, there isn't any good way to include that module with compileDebug.

The easiest way to set up fake billing in debug currently is with something like this:

val billingApi = if (BuildConfig.DEBUG) {
     FakeInAppBillingV3Api.addTestProduct(NO_ADS_PRODUCT)
     FakeInAppBillingV3Api(activity)
 } else {
     InAppBillingV3API()
 }

However, that requires that FakeInAppBillingV3Api be present in all builds, or the code won't compile. What would be more useful is for some way to set up fake billing without referencing debug-only code.

There are a few ways to do it. One is to make another apk that has stubs for the fake stuff, which would result in a build file like this:

compile(name: 'cashier-0.1.0', ext: 'aar')
compile(name: 'cashier-iab-0.1.0', ext: 'aar')
compile(name: 'cashier-iab-fake-0.1.0', ext: 'aar')
compileDebug(name: 'cashier-iab-fake-debug-0.1.0', ext: 'aar')

You could also move the external interface back into Cashier and some reflection. There are other ways to do it as well. As it is, the separate artifact for iab-debug is only useful for the the manifest merge.

Improve logger

The logger class is pretty barebones, it also exposes an api to set a log tag, which is not ideal since the user can never effectively set a tag. This is because vendors will override the tag on creation.

Additionally, there are a lot of exceptions that are caught where the exception itself is never propagated to the user. Should either log that to the logger or make it a part of Vendor.Error

Alter the fake checkout activity

Currently the fake checkout experience looks way too similar to the real checkout process and may be confusing. It should be different enough that there is no question as to what checkout process is in use.

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.