j3k0 / cordova-plugin-purchase

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

[IOS] Error 6777002 #1238

Open rafaellop opened 3 years ago

rafaellop commented 3 years ago

system info

MacOS 10.15.4 Plugin cordova-plugin-purchase 10.6.1 XCode version 12.1 cordova 10.0.0 iOS Platform version 6.1.0

Expected behavior

No errors

Observed behavior

In the store DEBUG mode app throws the following when started:

[Log] [store.js] DEBUG: ios -> loading products (cordova.js, line 1413)
[Log] InAppPurchase[js]: load ["productA", "productB", etc... ] (cordova.js, line 1413)
[Log] InAppPurchase[js]: load failed (cordova.js, line 1413)
[Log] InAppPurchase[js]: UNKNOWN_ERROR (cordova.js, line 1413)
[Log] [store.js] ERROR: ios -> ERROR 6777002: Load failed: UNKNOWN_ERROR - {} (cordova.js, line 1413)
[Log] [store.js] WARNING: ios -> loading products failed (cordova.js, line 1413)

If I try to start a purchase then this happens after the standard log:

[Log] [store.js] DEBUG: store.trigger -> triggering action re-refreshed (cordova.js, line 1413)
[Log] InAppPurchase[js]: refreshing appStoreReceipt (cordova.js, line 1413)
[Log] InAppPurchase[js]: load failed (cordova.js, line 1413)
[Log] InAppPurchase[js]: UNKNOWN_ERROR (cordova.js, line 1413)
[Log] [store.js] ERROR: ios -> ERROR 6777002: Load failed: UNKNOWN_ERROR - {} (cordova.js, line 1413)
[Log] [store.js] WARNING: ios -> loading products failed (cordova.js, line 1413)
[Log] [store.js] DEBUG: store.trigger -> triggering action refresh-finished (cordova.js, line 1413)
[Log] [store.js] WARNING: ios -> restore failed with code:6777006 (cordova.js, line 1413)
[Log] [store.js] DEBUG: store.trigger -> triggering action refresh-cancelled (cordova.js, line 1413)

The 6777002 is the error I get It happens on the simulator but also on real devices. I'm not sure but maybe it's related to the XCode 12.1 version and the discount feature introduced in the plugin which requires the 12.2 version of the XCode, but I'm not able to upgrade due to the MacOS version which is not the newest, but I really can't update my system each time I build my app. I'll eventually do that, but is there a way to bring back the proper behavior or is my thinking right the reason is the XCode version? I use the plugin for a few years now so it's not a new build issue. It seems it started to happen with some update to the plugin.

rafaellop commented 3 years ago

I've just uploaded a package built with 10.2.0 and it doesn't show the error on a real device but still on simulator. I'll try to upgrade xcode do 12.2. It seems it's enough to install it on Catalina (only 12.3 and abvoe requires MacOs 11+). I'll report.

rafaellop commented 3 years ago

This is strange. With the version 10.6.1 store does load and there are no errors, but only when app is installed through the Testflight app. I tested it and released to the public Appstore when it worked, but people complain it still doesn't work. So I tested it from the Appstore and indeed the same build which works properly if installed from the Testflight app, doesn't work if installed from Appstore. I'm out of ideas. Please help with that.

rafaellop commented 3 years ago

@j3k0 I'm sorry but maybe you could advice? The app is fires the store.ready callback on a real device if tested from xcode or testflight but the store.ready is never executed for the same build is installed from the Appstore. Everything works perfectly when testing outside the Appstore and I cannot even debug that and find on my own what's wrong. Maybe my workflow is wrong but I didn't change anything in my code except updating the plugin to the latest version. Purchasing worked perfectly before. All my apps with the 9.0.0 work properly.

rafaellop commented 3 years ago

It seems the issue is related to the application product validation. My own validator, which I use to validate product purchases, doesn't handle this. Is there a way to respond to this call with a proper value so that the store is ready? Or is there maybe a way to disable this validation on the app side (it generates quite a number of calls to my backend)?

P.S. I'm unable to find any docs related to this.

rafaellop commented 3 years ago

OK, I fixed my problem, but it's very unclear from the symptoms where to look for the solution or docs are lacking. It seems the Testflight versions doesn't check application receipt when using validators and in my case my validator didn't respond at all (returning nothing) to calls from the productions builds when type of the call was application. So I modified my backend script to return a simple json string {"ok":true} for the application type which fixed that issue and now store is getting ready properly and my IAPs are working back again.

@j3k0 But I personally think that the plugin code should handle this situation and also there should be an option to disable the application receipt checks completely. If somebody doesn't use it and only validating products, the application receipt validation still generates traffic which for popular apps may be huge.

mariogarranz commented 2 years ago

I am having the same issue.

MacOS 11.5.2 Plugin cordova-plugin-purchase 10.6.1 XCode version 12.5.1 cordova 10.0.0 iOS Platform version 6.2.0

I do register all my products (all of them are CONSUMABLE), and then run store.refresh();

I do get constant responses with 6777002 errors (tested on simulator only), and products never get past the REGISTERED state.

I am not using validator at all.

rafaellop commented 2 years ago

Please try on a real device. I've had no success in testing purchases in simulator getting the same error.

mariogarranz commented 2 years ago

@rafaellop Indeed, I just tested it on a real device today and the issue is not happening. So as far as I can tell the plugin does not work on iOS Simulator only. It is a different issue to the one you were reporting.

stale[bot] commented 2 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.