4 Replies
      Latest reply on Jan 9, 2019 1:56 PM by ortwin
      ortwin Level 1 Level 1 (0 points)

        When implementing IAP renewable subscriptions and changing the renewal option within a subscription group (e.g. changing from a monthly to a yearly subscription) the transaction observer (paymentQueue:queue:transactions:) always gets passed a transaction with a .failed transactionState even though the subscription change seems to have gone through successfully (according to the "Your are all set" alert and the server-to-server notification and receipt validation).

         

        Example:

        Assuming that 3 subscription SKUs are available (1-Week, 3-Months, 1-Year):

         

        - Subscribe to 1-Week SKU

        - Wait for completion

        - Change subscription to 3-Months

        - "You are all set" is displayed.

        - A transaction with transactionState = .failed is sent to the SKPaymentTransactionObserver. The transaction.error:

        Error Domain=SKErrorDomain Code=0 "Cannot connect to iTunes Store"

         

        I also filed this as rdar 47152431 (also on Open Radar).

         

        Is this a known issue?

        • Re: Failed transaction on subscription change
          rich Apple Staff Apple Staff (245 points)

          The problem which you have described leads me to ask - In the App Store Connect records for your application - what is the order of the subscription items within the subscription group. Is the 1 Week subscription plan an upgrade to the 3 month subscription? or vice versa? The ordering of the subscription items listed in the application records determines whether one subscription item is an upgrade or a downgrade to another item. Duration of subscription is not used to determine whether one subscription item is an upgrade or a downgrade to another subscription item.

           

          As such, per the In-App Purchase Program Guide - Working with subscriptions section, Upgrades and Plan Changes subsection

          <https://developer.apple.com/library/archive/documentation/NetworkingInternet/Conceptual/StoreKitGuide/Chapters/Subscriptions.html#//apple_ref/doc/uid/TP40008267-CH7-SW4>

           

          "Users can manage their subscriptions in their account settings on the App Store, or within your app’s interface. For each subscription, the App Store shows all the renewal options that the subscription group offers. Users can easily change their service levels and choose to upgrade, downgrade, or cross-grade as often as they like. Downgrades of any duration or cross-grades with different durations go into effect at the next renewal date."

           

          If the 3 month plan is a downgrade to the 1 week plan, then when the 1 week plan is currently active for a subscriber, then if the user attempts to "downgrade" to the 3 month plan, the iTunes Store should indicate to the user that the new plan will go into effect at the end of the current subscription. In this case, the user account has not been charged. The essence is that the transaction was not a success, but instead a failure. As there is no "user to be charged later" state, the App Store returns the failed transaction result.

           

          Keep in mind, that the app should already know that there is an active subscription in place which the user should still have access to.

           

          There's also server-to-server notifications when this happens, but that was not the question.

           

          rich kubota - rkubota@apple.com

          developer technical support CoreOS/Hardware/MFI

            • Re: Failed transaction on subscription change
              ortwin Level 1 Level 1 (0 points)

              Thanks for your detailed answer, Rich. Our current order is Weekly, Yearly, Quarterly (from top to bottom). How should it be and is there a way to change the order in App Store Connect?

               

              However, we receive the .failed transaction regardless of the order of the subscription change. No matter whether we start with Weekly and switch to Quarterly, or start with Quarterly and switch to Weekly, we always get that .failed transaction. So apparently it doesn't matter whether it's a downgrade or upgrade.

               

              Also, shouldn't there be some sort of confirmation from StoreKit that a renewal pref change went through? Seeing an "All set" alert from StoreKit followed by a .failed transaction seems very strange.

                • Re: Failed transaction on subscription change
                  PBK Level 7 Level 7 (3,055 points)

                  One speculative answer - I was always confused about this upgrade/downgrade idea and how the app store can figure out what to charge if you are half way through one subscription and you upgrade to another subscription.  In all cases, I think (but I could be wrong) that at the conclusion of the current subscription period (even if the user upgraded or downgraded) the user will be told that the subscription will autorenew to the upgraded or downgraded subscription period and, if they don't object, the subscription for the upgrade (or downgrade) renews.  In that case, the change in subscription itself, whether it is an upgrade or a downgrade, would result in nothing being billed until the current subscription expires - and therefore the change itself results in a 'failed' transaction.

                   

                  And another speculative answer - when a user tries to make a purchase and their credit card info is out of date, the App Store asks them to update the credit card info.  After they upgrade the credit card info the App Store asks if they want to go forward with the purchase?  If they say yes the App Store generates two successive transactions - one failed and the other purchased.  Is that what is going on in the case of an upgrade?