3 Replies
      Latest reply on Nov 4, 2019 2:18 PM by PBK
      ahmad91 Level 1 Level 1 (0 points)

        I'm validating consumable IAPs receipt on my server, but the in_app field is most likely to be empty in all receipts and the status field is 0.

        Does this mean the IAP is successful? how do I get the product_id with the empty in_app field?

         

        Also the original_purchase_date in some receipt is very old. like it shows 2018 but my app have IAPs two months ago, so it should be 2019 at least. is this ok?

        • Re: is the receipt valid with empty in_app?
          PBK Level 7 Level 7 (3,295 points)

          >  consumable IAPs receipt on my server, but the in_app field is most likely to be empty in all receipts and the status field is 0.

          Does this mean the IAP is successful? how do I get the product_id with the empty in_app field?

           

          The receipt will contain the information for a consumable IAP until the app calls finishTransaction on the purchase.  Then StoreKit will remove that purchase from the receipt.  

           

          > Also the original_purchase_date in some receipt is very old. like it shows 2018 but my app have IAPs two months ago, so it should be 2019 at least. is this ok?

           

          Each IAP in a receipt will have an original_purchase_date that indicates the original purchase date of that IAP.  If you restore the purchase or repurchase the IAP (for free) then that will not change the original_purchase_date.  Autorenewable subscriptions are different.

            • Re: is the receipt valid with empty in_app?
              ahmad91 Level 1 Level 1 (0 points)

              so I should take the receipt before calling finishTransaction and verify the receipt on my server then go back to the application and call finishTransaction.

              is this the right way? because right now I'm fetching the receipt after calling finishTransaction.

                • Re: is the receipt valid with empty in_app?
                  PBK Level 7 Level 7 (3,295 points)

                  You must fetch the receipt for a consumable IAP before you call finishTransaction.  Apple's "best practice" is to complete everything associated with the transaction before calling finishTransaction as you are proposing.  I believe that "better than best practice" is to store things within updatedTransactions, then call finishTransaction within updatedTransactions and then complete whatever needs to be done to complete the transaction using the things you have stored.  Leaving a transaction unfinished is the source of many problems.