Comments (12)
I see why you would need that, and no it's not already possible.
The thing is that I would like to keep the API simple for people with simple needs (i.e. most people).
For it to be suitable for all advanced needs, I guess we will end up exposing the whole Obj-C API to JS, which btw I think would be great. Advanced users could then do whatever they need by taping directly into this low-level API. The simplified API would just be a layer above that.
As this would require almost a full rewrite of the plugin, it won't be for today (except if someone sponsors this dev).
from cordova-plugin-purchase.
I completely understand your desire to keep it simple, but in this particular case, I think all you would need is a flag in the init function (like the debug flag). Call it the autoFinish flag or something. And you can have it default to true so that it doesn't affect existing users. Leave everything exactly the same, but separate out the finish call.
if autoFinish = true
--> finish
else
--> do nothing (the user can manually call finish)
Right?
from cordova-plugin-purchase.
Sure the API can be tweaked for this particular thing. Well, internally it wont be as simple as you think, as the finishTransaction:
method will need the objc transaction object as a parameter, so we need to maintain internally the list of unfinished transaction objects (probably in a id => object
dictionary), to retrieve it later when the user calls finish
. Then we probably have to add another method to cleanup/cancel unfinished transactions (those that won't be finished).
So of course I can hack this, but then I will have to hack something else for a different need. Little by little the code will begin to look kind messy, with special case 1, special case 2, etc. That's why I'm considering solving everyone's issues once and for all, by simply exposing the full objc API in JS.
Anyway, I will probably go for the tweak first, as this would add the functionality you need and I cannot spend too much time on this.
from cordova-plugin-purchase.
Thanks very much! Would be a huge help for sure.
from cordova-plugin-purchase.
Commit 40b2230 changes a behaviour when autoFinish is set to false. Failed transactions are now automatically finished. Would there be any reason not to?
from cordova-plugin-purchase.
@j3k0 No, I agree with you, can't see any reason not to. Cause a failed transaction is essentially dead anyway. No need to have the javascript finish it manually.
from cordova-plugin-purchase.
Was this feature confirmed to be working, I am running into an issue where I am calling noAutoFinish but the transaction is still being committed before I call finish.
I want to confirm this is working to rule out this layer as being the problem.
Thanks, love the plugin btw, got me up and running in no time.
Forgot to mention that I am using version 3.4.1
from cordova-plugin-purchase.
Hi tommy, noAutoFinish should work as expected. Any logs or code to share so I can dig in your problem?
from cordova-plugin-purchase.
Thanks, I will collect more info and get back to you.
from cordova-plugin-purchase.
I debugged it and looks like the feature is not working. The purchase starts and I see this in the logs.
2014-11-07 12:20:22.832 Play2Prep[2815:60b] InAppPurchase[objc]: Payment transaction updated (com.play2prep.play2prep.monthly.subscription):
2014-11-07 12:20:22.834 Play2Prep[2815:60b] InAppPurchase[objc]: State: PaymentTransactionStatePurchased
but the code at the end of method "paymentQueue" calls the unfinished (else) block as expected.
if (g_autoFinishEnabled) {
[[SKPaymentQueue defaultQueue] finishTransaction:transaction];
[self transactionFinished:transaction];
}
else {
[unfinishedTransactions setObject:transaction forKey:transactionIdentifier];
}
but without the "transactionFinished" method being called, the transaction goes through. I am testing this with an itunes connect test user. I tested this on iOS 7.1 and 8.0.
Any additional thoughts?
from cordova-plugin-purchase.
Disregard, the sandbox purchase confirmation popup was misleading and confused me. I went into manage subscription and did not see it there. The transaction feature is working.
from cordova-plugin-purchase.
Alright! Thank you for the follow up. Do you see anything that could have been added in the doc to make this clearer?
from cordova-plugin-purchase.
Related Issues (20)
- [CdvPurchase] INFO: order(undefined) at the time of order place HOT 21
- After lib code to 3.9.0 previous Android functionality stopped working. HOT 2
- Access to the Apple's appStoreReceipt. HOT 17
- Detecting failed purchases does not work in v13 HOT 3
- Detecting invalid products does not work in v13 HOT 5
- iOS Unable to complete a consumable product purchase HOT 3
- Not found error for PAID_SUBSCRIPTION, CONSUMABLE works fine (Google Play) HOT 4
- Micro Example uses CdvPurchase.CONSUMABLE instead of CdvPurchase.ProductType.CONSUMABLE
- How to detect active subscription when visiting subscription page HOT 3
- iOS error 6777001, Setup failed, during store initialization HOT 1
- Incomplete Content-Security-Policy example
- Repurchase an expired subscription IOS HOT 1
- getOffer returns nothing on iOS HOT 3
- Android register product is failed, store.product gives blank array[], But Work fine in Ios HOT 4
- Initialize function never resolves on Android in case of errors HOT 2
- Create CdvPurchase... printing twice HOT 2
- Validate receipt on app startup on V13 HOT 4
- Documentation issue/question HOT 2
- [Android] Issue BILLING_UNAVAILABLE code 6777003 when try to make purchase HOT 1
- Check if user has an active subscription HOT 5
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from cordova-plugin-purchase.