-
-
Notifications
You must be signed in to change notification settings - Fork 531
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
cordova-plugin-purchase v13 not working on ionic 3 #1455
Comments
Same. This looks like to be similar to issue #1442 |
Version 13 will not work together with @ionic-native/in-app-purchase-2 but you can use the plugin directly. Just remove @ionic-native/in-app-purchase-2 then use CdvPurchase.store instead of inject the module and call this.store |
Same here. Could it be because the CdvPurchase Object is set in a setTimeout callback: https://github.com/j3k0/cordova-plugin-purchase/blob/master/src/ts/store.ts#L719? |
same problem , any solutions ? |
It looks like most people make it work now, I don't know the issue nor solution to this unfortunately. With a bit more details maybe I could give pointers. |
Maybe you need to look for correct case of the CdvPurchase objects (write them with a big letter f.e.) or define them like this: Here is an example: #1442 Though, my product could still not be registered, like mentioned in the issue above. |
Can anyone confirms that the plugin works with ionic 3, so we can close this issue? |
Hi @j3k0, the problem remains the same, I can't get it to work with ionic 3, I have tried the latest updates to the repository but it remains the same. |
These days I will try what @tien271 suggested although I am not sure how to proceed but I will try |
Hi @rol4x4 it is now working on my project, so
|
Notice it's not necessary to call await CdvPurchase.store.initialize();
// do not call update: initialize already does it...
// await CdvPurchase.store.update(); And handle case where trying to purchase a product that doesn't exists. const product = CdvPurchase.store.get(productId);
if (!product) return alert("Product not found (might not be available in your country)");
if (product.canPurchase) { CdvPurchase.store.order(product.getOffer()); } Full code example here: https://github.com/j3k0/cordova-subscription-example |
Hi @j3k0 @tien271, thank you for your suggestions, the problem is that my project is a little old and works with typescript 2.4.2, angular 5 and when directly importing the cordova-plugin-purchase it throws a lot of exceptions of typescript. |
Maybe you could just do this: declare CdvPurchase: any; and use it in your code (without typescript types basically) |
Hi, @rol4x4, Did you manage to solve it? In Ionic 3 I believe it is correct to declare const { store, ProductType, Platform: p } = CdvPurchase; and import the plugin import 'cordova-plugin-purchase'; However, the problem is to do ionic cordova build android --prod, as it gives some errors due to the fact that the project is in typescript 4 and we cannot reach this version in ionic 3 putting the object like this: It worked on my phone, but in production we had many customers reporting a white screen and we had to return to version v11 for now to pause the problems |
Hi @fellipefonseca, thank you for sharing your code, I will try it, I have tried some codes but I still have some conflicts, what a shame until version 11 which worked perfectly, all that remains is to continue investigating to find the best solution. |
Hi @fellipefonseca, the solution for ionic 3 is already published in the readme file |
Thanks, @rol4x4. Were you able to compile it in production without errors in node_modules? |
Hi @fellipefonseca , yes I had no problems building it in production. |
It worked. Thank you |
Hi everyone, we use ionic 3 and the cordova-plugin-purchase plugin, this plugin worked normally until version 11, now due to the changes in Google we updated to version 13 but the plugin stopped working, it only shows
Create CdvPurchase... and it doesn't go from there
Could someone advise us?
thanks.
The text was updated successfully, but these errors were encountered: