cozycodegh / cordova-plugin-inapppurchases Goto Github PK
View Code? Open in Web Editor NEW2023 cordova plugin to add in-app purchases and subscriptions into an iOS or Android app
License: MIT License
2023 cordova plugin to add in-app purchases and subscriptions into an iOS or Android app
License: MIT License
Would it be possible to improve the error message formatting?
Currently it looks like this:
{"code":-4,
"message":"UNKNOWN_ERROR InAppBilling Error",
"iabText": "Billing response error: A user billing error occurred during processing. Google Play In-app Billing API version is less than 3Error checking for billing v5 support.",
"responseCode":3,
"iabCode":-4}
I'd like to show to the end user what the error is.
E.g. both iabText
and message
seem to consist of two or more concatenated strings (e.g. "Billing response error: A user billing error occurred during processing. Google Play In-app Billing API version is less than 3"
and "Error checking for billing v5 support."
). Is it possible to keep them separate in the error response?
Google play has the option to add subscription offers (e.g. 7 day free trial). But I didn't find a way to handle this in the implementation of this package.
Are there any plans to add it?
Example:
I have a base plan setup that runs for 2.39€ / month and a 7 day trial offer:
I'm able to subscribe to this, however, I can't fetch the price of the base plan. Instead, I get a 0 cost reply from getAllProductInfo
:
Hello, thank you for this plugin.
I have been working on a cordova app for several years now and am trying to test and then promote my app on the play store. I would like to allow my user to upgrade or downgrade through the three subscriptions I offer. Android implements upgrades and downgrades differently form App Store Connect. Android developer information offers this suggestion to implement upgrade and downgrade. Unfortunately my Java ability is pretty low, so I'm not sure how to execute those directions. I can see "BillingFlowParams billingFlowParams" in the IabHelper.java file, line 645, in the launchBillingFlowAsync method which is used in the InAppBilling.java file, lines 483 and 492, eventually going back to the purchase method on line 593 in the same file. You would need to pass back the old and new subscriptions and the replacement mode indicating any change in the billing and access because of the upgrade or downgrade in the inAppPurchase.purchase() method.
I have looked through the code, forks, and pull requests and don't see any indication that this has been addressed so please let me know if this has already been implemented.
Thanks in advance,
Marjika
Hi Cozycodegh, thanks for your plugin.
I need help to use into ionic cordova application.
What should I do ?
I am using the latest version of the plugin, but I am having an error when trying to make some strange use case, the problem I am having is that when I buy an InApp, the purchase window appears, but before the purchase message appears confirmed I close the app, with the app closed I see that the confirmed purchase window appears, I open the app again, and I do not see any log referring to that purchase, I execute restorePurchases and it returns an empty object, and if I try to buy the same article, Apple tells me that I already have this article, but the plugin does not give me an error at this point and should give me an error that I already have the article so I can consume it.
Thanks for the plugin.
First of all, thanks for this plugin!
I noticed odd behavior of my app after I upgraded this plugin from 2.4.8 to 3.0.2. Going through the commits, I noticed this line:
completed: res.pending == 0,
at 0bc203c#diff-f03cc1bc99555771d580b62c075ca39d17dffbdd8498c73b84d584c1ca83feebR245
Every purchase I make in my app is now flagged 'completed', even though in fact they're not (once a purchase is successful, it needs to be completed manually to unlock the product in case of a consumable).
All in all, I think that line should be:
completed: res.completed == 1,
First of all thanks for coding up this lib. It's the only working one that I could find after a lot of digging. 🙏
Possibly the same issue that was fixed here? RainerAppel/cordova-plugin-inapppurchase@master...richmoh:cordova-plugin-inapppurchase:master
Stack trace:
Fatal Exception: java.lang.RuntimeException: Unable to start activity ComponentInfo{<packagename>/com.android.billingclient.api.ProxyBillingActivity}: java.lang.NullPointerException: Attempt to invoke virtual method 'android.content.IntentSender android.app.PendingIntent.getIntentSender()' on a null object reference
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2778)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2856)
at android.app.ActivityThread.-wrap11(ActivityThread.java)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1589)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loop(Looper.java:164)
at android.app.ActivityThread.main(ActivityThread.java:6494)
at java.lang.reflect.Method.invoke(Method.java)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:438)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:807)
Caused by java.lang.NullPointerException: Attempt to invoke virtual method 'android.content.IntentSender android.app.PendingIntent.getIntentSender()' on a null object reference
at com.android.billingclient.api.ProxyBillingActivity.onCreate(ProxyBillingActivity.java:121)
at android.app.Activity.performCreate(Activity.java:7009)
at android.app.Activity.performCreate(Activity.java:7000)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1214)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2731)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2856)
at android.app.ActivityThread.-wrap11(ActivityThread.java)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1589)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loop(Looper.java:164)
at android.app.ActivityThread.main(ActivityThread.java:6494)
at java.lang.reflect.Method.invoke(Method.java)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:438)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:807)
Here's the raw stacktrace from crashlytics: stacktrace.txt
Greetings.
Could you help me with the problem I'm facing?
I am unable to consume the product, so it is not available for new purchase.
Here's the code:
function buyPaidContent() {
var product_id_1 = localStorage.getItem("product_id_1");
inAppPurchases.purchase(product_id_1).then(function (purchase) {
if (purchase["pending"]) {
// alert("waiting for payment to complete");
return; //not paid for yet
}
var creditos_app = localStorage.getItem("creditos_app");
creditos_app = parseInt(creditos_app)
var product_id_1 = localStorage.getItem("product_id_1");
return inAppPurchases.completePurchase(product_id_1);
}).then(function (purchase) {
app.views.main.router.navigate('/home/');
}).catch(function (err) {
alert("Assinatura não efetuada");
alert(JSON.stringify(err));
logError(err);
});
Thank you friends
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.