AlexDisler / cordova-plugin-inapppurchase

A lightweight cordova plugin for in app purchases on iOS/Android
316 stars 192 forks source link

Multiple Errors Returned from App Stores #210

Open cdcv opened 6 years ago

cdcv commented 6 years ago

We are having a serious problem with inAppPurchase which means that very few of our sales are currently going through.

We are getting a high percentage of errors back from the app stores (both iOS and Android) when users attempt to make purchases and we call inAppPurchase.subscribe. We'd seen similar behavior with .buy. We're pretty sure that we have the code, entitlements, certs, etc set up at least mostly right because SOME of the purchases are going through correctly. However, most attempted sales (>95%) are resulting in some kind of error. Most appear to be technical errors. Some of these are presumably user-initiated cancels (ie user didn't complete the purchase). What percent of user cancels is 'typical' for different apps that people have seen (sure it's different for each one, but some comparison would be great)? It seems like we're getting way too many errors, and something must be wrong. It would be great to get:

1) Help fixing the problem. 2) Other users experience on what percent errors and user cancels you have seen.

Here is a breakdown of the errors from an example period. There were 39 errors and only 2 successful transactions. This is only for unique errors. There were more if repeats were included. For example, one user attempted the purchase 17 times over about an hour, each time receiving the error: Cannot connect to iTunes Store', errorCode: 2

It should be noted that all of these users, including successful sales on both iOS and Android, were using the same code (& same everything so far as we are aware).

None of these are test transactions, they are all live.

Here is the breakdown of errors from an example period:

Instances | Error

-- | -- 8 | code: -5,      message: 'Purchase Cancelled',      text: 'User canceled. (response: -1005:User cancelled)',      response: -1005,      errorCode: -5 } } 15 | code: -6,      message: 'Could not complete purchase',      text: 'Null data in IAB result (response: -1002:Bad response received)',      response: -1002,      errorCode: -6 } } 2 | line: 327,      column: 519773,      sourceURL: 'https://app0x.oncamera.co/f026101119b61caab3a50f9acd5653c88c57d809.js?meteor_js_resource=true' } } 2 | Can't start async operation (launchPurchaseFlow) because another async operation(launchPurchaseFlow) is in progress.' } 6 | errrMessage: 'Cannot connect to iTunes Store', errorCode: 2 } } 2 | Blank 39 | Total

Please include:

Your code / steps to reproduce

To initialize: inAppPurchase .getProducts([selectedProductId]) .then(function (products) { console.log('Registered products:',JSON.stringify(products)); inAppPurchaseCdC.productsRegistered.set(true); }) .catch(function (err) { console.log('Register products error:',JSON.stringify(err)); });

When user clicks 'subscribe':

   inAppPurchase
        .subscribe(productId)
        .then(function (data) {
            console.log('Purchase Completed:',JSON.stringify(data));
            AppLogger.logPayments({inAppPurchaseResult:data});
            /*
             {
             transactionId: ...
             receipt: ...
             signature: ...
             }
             */
            inAppPurchaseCdC.processPurchaseSuccessful();
        })
        .catch(function (err) {
            console.log('Purchase error:',JSON.stringify(err));
            AppLogger.logPayments({inAppPurchaseResult:err});
            PurchaseClass.processPurchaseError();
        });

### Console output
We don't see anything meaningful in the console, beyond the error msgs that are returned, and that we pasted above.

### Type of product you are working with consumable/non-consumable/subscription
Subscription service provided through the app.

### Version of cordova
7.1.0

### Version of iOS/Android
Installed platforms:
  android 6.2.3
  ios 4.5.4

We are using these versions for compatibility with other plugins.

Thank you for your help!
joshlit commented 6 years ago

I'm currently experiencing the exact same issue using only buy with live products. I've even tried creating new products and purchasing them with a sandbox tester account and I am having the exact same issue.