Changing renewable subscription in iOS In-app purchase triggers "Cannot connect to iTunes Store" error

Viewed 399

I have multiple renewable subscriptions set up for my App in App Store Connect.

enter image description here

There are a handful of renewable subscriptions which are all part of the same subscription group, plus one which is a non-renewable subscription.

I am using react-native-iap which uses the StoreKit under the hood.

I am using a sandox user account as created under "Users and Access" > "Sandbox" > "Testers" logged in as a sandbox user on the iPhone. I am logged in as that user on the iPhone under "iTunes & App Stores" > "SANDBOX ACCOUNT".

I can successfully fetch the subscriptions using 'RNIap.getSubscriptions()' and display them in the UI. I can then successfully trigger a purchase of a subscription using RNIap.requestSubscription(productId, false) after which my registered RNIap.purchaseUpdatedListener handler correctly fires, and I finish the transaction using RNIap.finishTransactionIOS(purchase.transactionId). So far, so good.

The problem arises when I try to make subsequent changes to the renewable subscription, by following the same process with one of the other subscriptions. I get a pop-up asking whether I want to confirm the modification to the new subscription, as expected, followed by "You're all set, Your purchase was successful". But I when this happens it actually calls the RNIap.purchaseErrorListener event handler, rather than the RNIap.purchaseUpdatedListener as expected.

The error message I get from the handler is:

{
    responseCode: "0",
    code: "E_UNKNOWN",
    debugMessage: "Cannot connect to iTunes Store",
    message: "Cannot connect to iTunes Store"
}

Which originates from the StoreKit api itself when transaction.transactionState is equal to SKPaymentTransactionStateFailed.

If I then ettempt to buy thnon-renewable subscription (1 Week in the above example) the purchase is successful, triggering the RNIap.purchaseUpdatedListener as expected. But whenever I try to change the subscription to another renewable subscription again the RNIap.purchaseErrorListener handler is triggered.

So I guess my question is this: "Why does the RNIap.purchaseErrorListener handler trigger instead of the RNIap.purchaseUpdatedListener handler when trying to change from a renewable subscription to another renewable subscription?"

0 Answers
Related