j3k0 / cordova-plugin-purchase

In-App Purchase for Cordova on iOS, Android and Windows
https://purchase.cordova.fovea.cc
1.29k stars 529 forks source link

Android Support #32

Closed j3k0 closed 9 years ago

j3k0 commented 10 years ago

Add android support to the plugin. Turn it into a multi-platform In-App-Purchase solution.

The idea would be to provide as much abstraction of the platform as possible, yet giving access to platform specific APIs.

It could be implemented as a layered architecture:

It probably won't be possible to abstract everything, I think about things like receipts validation for instance... (except if we also provide server-side code, but lets keep this for later).

This is just a starting point of reflection. Please tell me what you think, share your remarks and ideas.

fedme commented 10 years ago

I can suggest this one https://github.com/poiuytrez/AndroidInAppBilling it is the best coded and it is updated and working. If you and the other developer could join the projects it would be awesome (I could help with a donation - one of my client needs this- or a dedicated website creation)

j3k0 commented 10 years ago

Hi, thanks @raimaj for the suggestion. This plugin looks good. On my side I probably won't be able to work on that before summer, then if enough people are interested I definitely will.

dneves commented 10 years ago

where do i vote for this ? :)

Jacse commented 9 years ago

+1

manuelpaulo commented 9 years ago

+1

calendee commented 9 years ago

+!

calendee commented 9 years ago

JC : Thanks for the support tonight. When you are ready to move forward on Android, let me know. I will contribute some $$ to cover the development.

j3k0 commented 9 years ago

Call for sponsors.

I'm trying to rise some funds so I can afford dedicating a week of development to implement Android support in the cordova/phonegap in-app purchase plugin. I'll sponsor myself half of the cost, remaining $1,000 from you will be enough for the initial support.

This is a low-tech crowd-funding call: if you wan't to contribute, please answer with the amount here, or by private message if you wan't to stay anonymous. I'll then collect using PayPal.

This will save many developers a lot time, making the Cordova platform much more beneficial to everyone, thank you in advance!

calendee commented 9 years ago

I'm definitely willing to front a third of the remaining $1000 if you can get 2 more people to support.

fedme commented 9 years ago

I’m going to meet my client on Wednesday and talk to him about all of this, than I’ll be back to you and say how much we can spend in financing the plugin development.

About finding other contributors… may I suggest you to open a topic on the following forums:

We can split the “spamming on forums work” if you send me the message i should post on those forums, also.. have you thought about kickstarter?

Let me know and, if you post on some of these forums, link us the topics so that we can post answers ad keep the topics on top of the forums.

j3k0 commented 9 years ago

Hey @raimaj, excellent suggestions.

I set up a Indie Gogo campaign here http://igg.me/at/cordova-iap/x/8416559 -- let's see if that works

I'll share the link on the forums. Do you wan't to handle StackOverflow?

j3k0 commented 9 years ago

Here's the phonegap group thread: https://groups.google.com/forum/#!topic/phonegap/qcsOhZx6XqI

Link on the community forum: http://gsfn.us/t/4les0

As a new user, I cannot post links to xda-developers forums. Can you?

fedme commented 9 years ago

I'll try on xda and I'll handle stack overflow and facebook phonegap related pages/Groups ;)

Here's the phonegap group thread: https://groups.google.com/forum/#!topic/phonegap/qcsOhZx6XqI

Link on the community forum: http://gsfn.us/t/4les0

As a new user, I cannot post links to xda-developers forums. Can you?

— Reply to this email directly or view it on GitHub https://github.com/j3k0/PhoneGap-InAppPurchase-iOS/issues/32#issuecomment-51881594 .

j3k0 commented 9 years ago

Great, thanks!

On Tue, Aug 12, 2014 at 2:18 PM, Federico Meini notifications@github.com wrote:

I'll try on xda and I'll handle stack overflow and facebook phonegap related pages/Groups ;) Il 12/ago/2014 09:22 "Jean-Christophe Hoelt" notifications@github.com ha scritto:

Here's the phonegap group thread: https://groups.google.com/forum/#!topic/phonegap/qcsOhZx6XqI

Link on the community forum: http://gsfn.us/t/4les0

As a new user, I cannot post links to xda-developers forums. Can you?

— Reply to this email directly or view it on GitHub < https://github.com/j3k0/PhoneGap-InAppPurchase-iOS/issues/32#issuecomment-51881594>

.

— Reply to this email directly or view it on GitHub https://github.com/j3k0/PhoneGap-InAppPurchase-iOS/issues/32#issuecomment-51896638 .

calendee commented 9 years ago

Good idea to make this an IndieGogo. I've put $100 towards it already. if necessary, I'll put up to $333. Hopefully we get some traction with this and get the costs shared by a large group of devs.

fedme commented 9 years ago

I made a topic on XDA: http://forum.xda-developers.com/coding/web-apps/indiegogo-campaign-phonegap-cross-t2845525

Tomorrow I'll make my client do a donation on Indiegogo and start advertising the campaign on facebook and Stack overflow.

j3k0 commented 9 years ago

Thanks again @raimaj and @calendee for the help! There surely are other people interested, hopefully the message will reach them.

calendee commented 9 years ago

Posted to the Ionic Framework forum : http://forum.ionicframework.com/t/phonegap-cordova-in-app-purchase-plugin-fundraiser/8116

j3k0 commented 9 years ago

Raised almost $500 so far, half of the target. Do you have any other suggestions for new ways to get noticed? Or other people to contact?

MicheleV commented 9 years ago

Pledged! I'll try spreading the news to some of my friends using cordova, let's see if we can get to 1k.

fedme commented 9 years ago

Wonderful, we made it!! 115% funded

calendee commented 9 years ago

This is great. Let's hope a bit more rolls in so more work can be done.

j3k0 commented 9 years ago

Thanks @MicheleV Ionic folks and community played a major part in the funding, @calendee you're certainly responsible for that! I booked 18-sep to 25-sep to work on Android support. Any extra will be used to work on plugin, probably documentation as this could also use some improvement. I suggested on the campaign to create a documented sample project if I get a few more days, do you think this is useful / a good idea?

calendee commented 9 years ago

It would definitely be useful. A good starting point will help everyone get rolling. However, the actual code and documentation should be the top priority.

juliencousineau commented 9 years ago

If I use the plugins InAppPurchase right now, do will be difficult to adapt to your new Android support, or is better for me to wait? Btw thank you for this upgrade, as soon as I will integrate the plugins and test it, I will give money to the campaign

j3k0 commented 9 years ago

@juliencousineau I suppose there will be some adjustments to the API depending on Google store's own specificities, my idea is to keep those as few as possible.

However, Google and Apple's API are quite different, so maybe it would be a good time to clean up and start fresh. I'm thinking this through today. @calendee @raimaj @maxmoore14 or anyone who has an opinion about that, I'd be happy to hear it!

calendee commented 9 years ago

The most consistent API as possible would be best. Basically, it'd be great to hide the Apple/Google differences from the developer as much as possible.

However, that will take some time. So, if you need slightly different API's per vendor, then we'll understand.

maxmoore14 commented 9 years ago

I agree with @calendee in general. I'm happy to migrate over existing code to use new methods if it simplifies the overall API. It would be great if it were basically a black box that uses Apple or Google as needed - maybe even Microsoft someday - though their IAP is not as full featured yet. I don't think they even support recurring subscriptions yet.

One issue with Android to be wary of if you look at the existing plugin that's out there... Some people are used to validating receipts on the device. This is tricky since you need a unique account ID to validate with. There have been attempts to put that ID in javascript and/or the config.xml file, but both are really insecure. Best practice as far as I know is to always do server-side validation. My suggestion would be to not handle client-side validation at all - but if you do, be sure it is optional and recommended against in the readme.

It would really be great if you could pass along both a unified error code that can be used cross-platform and the underlying error code from the stores. Personally, I like to display my own "friendly" error messages, so I prefer error codes to test against rather than pre-defined error message strings.

j3k0 commented 9 years ago

Thank you guys for the comments.

Concerning the validation of receipts on the device, I suppose we can force the user to do server-side validation.

Something I was thinking about is specifying a server-side API that the plugin can use directly. This way, the plugin will handle validation by itself "in the background" for any platforms, without the user having to care about it.

Implementation of this server-side API could be provided in many languages if contributors are willing to participate... For increased level of security, a developer can also make his own implementation of the server-side API.

POST /api/v1/transaction
GET /api/v1/subscription/<id>
maxmoore14 commented 9 years ago

That makes sense. As long as there is an option to bypass the generalized APIs and go fully custom, that works. I have a use case where the receipt processing is so integral that I would just want the raw receipt (for Apple) and the raw transaction/signature (for Google). Then I can transfer that securely to the app server.

j3k0 commented 9 years ago

I'm trying to define a nice expressive API for the unified plugin.

https://github.com/j3k0/PhoneGap-InAppPurchase-iOS/blob/unified/doc/example.js

I think it's high-level enough to accommodate both iOS and Android way of doing things. It'll probably evolve a little when I make progress but that would be the idea.

Like it? Don't like it?

As a side note, I'm a bit late on my actual freelancing project, so dev will probably be globally delayed by a week.

maxmoore14 commented 9 years ago

I think that is really nice. Rather than try to force the Android API to look like iOS or vice versa, this just abstracts away the platform specifics. I like it.

calendee commented 9 years ago

That does look really elegant. Much easier than the existing API. Having this instead of developer having to choose an Android or iOS API is going to be so simple.

KshinG commented 9 years ago

Really like!

confile commented 9 years ago

+1

confile commented 9 years ago

Is there a release date for the Android version of this plugin?

j3k0 commented 9 years ago

Hi @confile, Android version should be done 10 days from now. Beta version certainly earlier than that.

confile commented 9 years ago

great I look forward to test it. Good work so far.

agamemnus commented 9 years ago

(Edited)

Hi.

I'm looking to implement the Android Google Play version when you have it ready.

From the documentation I see that we can send a server request (to OUR servers) to verify an in-app purchase. Per http://stackoverflow.com/questions/8379819/how-do-i-verify-android-in-app-billing-transactions-on-my-server, I see that we need some data, the signature, and a public key... then we run a decryption function to decrypt and check if the signature matches the data. Is $data and $signature exposed with this plugin somehow?

j3k0 commented 9 years ago

Hi @agamemnus - I'm still not at purchase validation with the plugin, so I cannot answer you for the moment. I'll let you know!

agamemnus commented 9 years ago

Need any help testing it or ....anything else...? I am a bit stuck without your plugin, which I hoped would be ready by now.

j3k0 commented 9 years ago

Hi @agamemnus,

You can start testing with this alpha release: cordova plugin add "https://github.com/j3k0/cordova-plugin-purchase#v3.9.0-alpha.1"

Or directly the develop branch (which I try to keep in a non-broken state): cordova plugin add "https://github.com/j3k0/cordova-plugin-purchase#develop"

For documentation, start here: https://github.com/j3k0/cordova-plugin-purchase/tree/develop

j3k0 commented 9 years ago

Good news: I'm almost done!

First beta release: https://github.com/j3k0/cordova-plugin-purchase/releases/tag/v3.9.0-beta.1

It's full-featured subscriptions, consumable, receipt validation, refunds, restore purchases). Tested successfully on iOS + Android.

I still have to make a final pass on the documentation, which is incomplete (or even wrong) in some place. Please test and ask me if you need help!

agamemnus commented 9 years ago

Great, thanks. I'll look it over and try to integrate it ASAP. I would love to see an example of the function that sends data to my server for validation...

j3k0 commented 9 years ago

Pull request of the release candidate here: #65

Some reports of this version working OK will be useful.

Closing this thread, thank you again for supporting this work!