5 Replies
      Latest reply on Mar 15, 2019 10:00 PM by PBK
      joipjiojoijiojio Level 1 Level 1 (0 points)

        Hello everyone,

         

        I'm restoring some non-consumable products, then doing a SKRefreshReceiptRequest, then looking into the contents of [[NSBundle mainBundle] appStoreReceiptURL].

         

        I see transactions being restored as expected but the receipt I get only has 1 in-app purchase instead of the 20-ish I expect to see. Is this normal behavior? How should I validate my restored products on a server?

        • Re: Restored non-consumable products missing from appStoreReceiptURL
          PBK Level 7 Level 7 (3,045 points)

          The in_app field in the receipt is an array of products.  It should contain 20 individual receipts.  Check again.

            • Re: Restored non-consumable products missing from appStoreReceiptURL
              joipjiojoijiojio Level 1 Level 1 (0 points)

              This is the list of transactions I get when using SKPaymentQueue restoreCompletedTransactions:

               

                {"productId":"com.groupebayard.jaimelirestore.lesorcieredutgv","transactionDate":"2019-03-15T14:27:13Z","transactionId":"1000000510743190","state":3},
                {"productId":"com.groupebayard.jaimelirestore.9782745998729","transactionDate":"2019-03-15T14:27:13Z","transactionId":"1000000510743191","state":3},
                {"productId":"com.groupebayard.jaimelirestore.QuatreSaisonsPOB","transactionDate":"2019-03-15T14:27:13Z","transactionId":"1000000510743192","state":3},
                {"productId":"com.groupebayard.jaimelirestore.tomtometnana.lefritequipique","transactionDate":"2019-03-15T14:27:13Z","transactionId":"1000000510743193","state":3},
                {"productId":"com.groupebayard.jaimelirestore.9782747073875","transactionDate":"2019-03-15T14:27:13Z","transactionId":"1000000510743194","state":3},
                {"productId":"com.groupebayard.jaimelirestore.pattapoils","transactionDate":"2019-03-15T14:27:13Z","transactionId":"1000000510743195","state":3},
                {"productId":"com.groupebayard.jaimelirestore.dragonsnalsara18","transactionDate":"2019-03-15T14:27:13Z","transactionId":"1000000510743196","state":3},
                {"productId":"com.groupebayard.jaimelirestore.Les39Cles_T2","transactionDate":"2019-03-15T14:27:13Z","transactionId":"1000000510743197","state":3},
                {"productId":"com.groupebayard.jaimelirestore.guideparents","transactionDate":"2019-03-15T14:27:13Z","transactionId":"1000000510743198","state":3},
                {"productId":"com.groupebayard.jaimelirestore.emilemargot5","transactionDate":"2019-03-15T14:27:13Z","transactionId":"1000000510743199","state":3},
                {"productId":"com.groupebayard.jaimelirestore.POBetsescopains","transactionDate":"2019-03-15T14:27:13Z","transactionId":"1000000510743200","state":3},
                {"productId":"com.groupebayard.jaimelirestore.9782745979872","transactionDate":"2019-03-15T14:27:13Z","transactionId":"1000000510743201","state":3},
                {"productId":"com.groupebayard.jaimelirestore.samsam1","transactionDate":"2019-03-15T14:27:13Z","transactionId":"1000000510743202","state":3},
                {"productId":"com.groupebayard.jaimelirestore.emilemargot3","transactionDate":"2019-03-15T14:27:13Z","transactionId":"1000000510743203","state":3},
                {"productId":"com.groupebayard.jaimelirestore.9999999999919","transactionDate":"2019-03-15T14:27:13Z","transactionId":"1000000510743204","state":3},
                {"productId":"com.groupebayard.jaimelirestore.TTNNalbum30","transactionDate":"2019-03-15T14:27:13Z","transactionId":"1000000510743205","state":3},
                {"productId":"com.groupebayard.jaimelirestore.duval2","transactionDate":"2019-03-15T14:27:13Z","transactionId":"1000000510743206","state":3},
                {"productId":"com.groupebayard.jaimelirestore.enquetealecole","transactionDate":"2019-03-15T14:27:13Z","transactionId":"1000000510743207","state":3},
                {"productId":"com.groupebayard.jaimelirestore.monsieurrastagnac","transactionDate":"2019-03-15T14:27:13Z","transactionId":"1000000510743208","state":3},
                {"productId":"com.groupebayard.jaimelirestore.9782747090520","transactionDate":"2019-03-15T14:27:13Z","transactionId":"1000000510743209","state":3},
                {"productId":"com.groupebayard.jaimelirestore.BHPTcollectionneur","transactionDate":"2019-03-15T14:27:13Z","transactionId":"1000000510743210","state":3},
                {"productId":"com.groupebayard.jaimelirestore.paddington1","transactionDate":"2019-03-15T14:27:13Z","transactionId":"1000000510743211","state":3},
                {"productId":"com.groupebayard.jaimelirestore.DroleBabySitter","transactionDate":"2019-03-15T14:27:13Z","transactionId":"1000000510743212","state":3},
                {"productId":"com.groupebayard.jaimelirestore.Les39Cles_T9","transactionDate":"2019-03-15T14:27:13Z","transactionId":"1000000510743213","state":3},
                {"productId":"com.groupebayard.jaimelirestore.devinette1","transactionDate":"2019-03-15T14:27:13Z","transactionId":"1000000510743214","state":3},
                {"productId":"com.groupebayard.jaimelirestore.cabane_magique_t42","transactionDate":"2019-03-15T14:27:13Z","transactionId":"1000000510743215","state":3},
                {"productId":"com.groupebayard.jaimelirestore.9791029315886","transactionDate":"2019-03-15T14:27:13Z","transactionId":"1000000510743216","state":3}

               

              For some reason the forum is not letting me paste the receipt data but you can find it here : https://pastebin.com/X2XeCH0p

              I decode that to :

               

              {
                "receipt_type": "ProductionSandbox",
                "adam_id": 0,
                "app_item_id": 0,
                "bundle_id": "com.groupebayard.jaimelirestore",
                "application_version": "2.9.0",
                "download_id": 0,
                "version_external_identifier": 0,
                "receipt_creation_date": "2019-03-15 14:31:34 Etc\/GMT",
                "receipt_creation_date_ms": "1552660294000",
                "receipt_creation_date_pst": "2019-03-15 07:31:34 America\/Los_Angeles",
                "request_date": "2019-03-15 14:32:31 Etc\/GMT",
                "request_date_ms": "1552660351130",
                "request_date_pst": "2019-03-15 07:32:31 America\/Los_Angeles",
                "original_purchase_date": "2013-08-01 07:00:00 Etc\/GMT",
                "original_purchase_date_ms": "1375340400000",
                "original_purchase_date_pst": "2013-08-01 00:00:00 America\/Los_Angeles",
                "original_application_version": "1.0",
                "in_app": [
                {
                "quantity": "1",
                "product_id": "com.groupebayard.jaimelirestore.9782745979872",
                "transaction_id": "1000000510443239",
                "original_transaction_id": "1000000510443239",
                "purchase_date": "2019-03-14 20:30:05 Etc\/GMT",
                "purchase_date_ms": "1552595405000",
                "purchase_date_pst": "2019-03-14 13:30:05 America\/Los_Angeles",
                "original_purchase_date": "2019-03-14 20:30:05 Etc\/GMT",
                "original_purchase_date_ms": "1552595405000",
                "original_purchase_date_pst": "2019-03-14 13:30:05 America\/Los_Angeles",
                "is_trial_period": "false"
                }
                ]
              }

               

              As you can see the in_app doesn't contain the restored transaction, nor the original ones.

              I did check that my code calls [queue finishTransaction:] for each restored transaction before trying to refresh the receipt.

               

              Each SKTransaction I get from restoreCompletedTransactions does contain a transactionReceipt that has info related to the restored transaction, but it's in a different format from the appReceipt. I see that method is deprecated too, so I'm hesitant to use it.

               

              If you have any idea what I could be missing it would be greatly appreciated.

               

              Thanks,

              T.

              • Re: Restored non-consumable products missing from appStoreReceiptURL
                joipjiojoijiojio Level 1 Level 1 (0 points)

                It looks like it might have had to do with the account I was using for testing, I was using my developer account instead of a proper sandbox account.

                 

                I had to go to the Settings app and log-out from the AppStore, then log-in with a dedicated sandbox account in the "Sandbox Account" at the far bottom of the "iTunes Store and App Store" page of the Settings app. This gets me the expected number of in_app entries in the receipt for the sandbox account.