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

iOS error 6777001, Setup failed, during store initialization #1502

Closed bigkingjohn closed 5 months ago

bigkingjohn commented 5 months ago

I'm using the plugin with an Angular app (v13) running on top of Capacitor (v4). For a small number of my iOS users, I'm logging errors in the return promise of CdvPurchase.Store.initialize

{
    "isError": true,
    "code": 6777001,
    "message": "Setup failed",
    "platform": "ios-appstore",
    "productId": null
}

I don't think this is a problem with the plugin (at least not the javascript half of it), but can you advise how to handle it?

I'm not actually certain what the end user behaviour is when this error is encountered. I've received a small number of reports of purchases not working, but they don't correlate with these errors.

Does this error mean in app purchases wont work?

Thanks for any help/advice you can provide

j3k0 commented 5 months ago

On iOS, Setup failed can only be triggered when the user has disabled in-app purchases, at low level: SKPaymentQueue.canMakePayment is false (which is a method provided from the native StoreKit SDK). The reason why this method returns false is not provided, but it's an issue between the user device and AppStore.

You can ask the user to check if they set up in-app purchases restrictions: Settings->Screen Time->Content & Privacy Restrictions (voluntarily or not...)

A recent version of the plugin has made this error more explicit (8cc493f)


After fixing the in-app purchases restrictions, the user should restart the app.