4 Replies
      Latest reply on Sep 17, 2019 5:46 AM by vscpaiva
      Vinnay Level 1 Level 1 (0 points)

        I am using In App Purchase (Auto Renewable Subscription) in our application, and when we validate the receipt on a device where the app is just installed, it returns a status of 0. Even if any purchase was not initiated from the device,  so 0  means the receipt is valid and we provide the paid contents to the user. This happens when the app is downloaded from the AppStore. 

        The way we are validating the receipt is as below: 

        1. NSURL *receiptURL = [[NSBundle mainBundle] appStoreReceiptURL];     NSData *receipt = [NSData dataWithContentsOfURL:receiptURL]; 

        2. Then converted the receipt into base64 encoded string. 

        3. Created NSData object of Dictionary with values    receipt-data : "Set the base64 string here"   password : "Set the shared secret here" 

        4. Then posted it to "https://buy.itunes.apple.com/verifyReceipt"  

        5. Then in response I got the status as 0, which means its valid.


        But I haven't made any purchase from that device. 

        Please suggest.

        • Re: Auto Renewable Receipt Validation STATUS 0
          PBK Level 7 Level 7 (3,765 points)

          As of iOS7, a valid receipt does not mean that the receipt contains the purchase of the IAP - it just means that the rceeipt is not fraudulenty presented to the device.  All apps have a valid receipt.





          and note that:


          "status  Either 0 if the receipt is valid, or one of the error codes listed in Table 2-1.

          For iOS 6 style transaction receipts, the status code reflects the status of the specific transaction’s receipt.

          For iOS 7 style app receipts, the status code is reflects the status of the app receipt as a whole. For example, if you send a valid app receipt that contains an expired subscription, the response is 0because the receipt as a whole is valid."

            • Re: Auto Renewable Receipt Validation STATUS 0
              Vinnay Level 1 Level 1 (0 points)

              Okay, So if the status is 0 it means the receipt is valid, but what should I do to check if the subscription has expired or not.

                • Re: Auto Renewable Receipt Validation STATUS 0
                  PBK Level 7 Level 7 (3,765 points)

                  Well there are two ways.  The first is to detect a call to updatedTransactions and use it, the second is to read what is on the receipt.  This is explained in the documentation referenced above and other documents on autorenewable subscriptions.  You could use, for example, 'expires_date' in the receipt.

                    • Re: Auto Renewable Receipt Validation STATUS 0
                      vscpaiva Level 1 Level 1 (0 points)

                      The thing is that when returns status 0, environment production, I have no information about the expire date, something as below:


                      { "receipt": { "receipt_type": "Production", "adam_id": xxxxxx, "app_item_id": xxxxx, "bundle_id": "br.einstein.amp", "application_version": "28", "download_id": 9999, "version_external_identifier": xxxxx, "receipt_creation_date": "2019-07-04 04:04:48 Etc/GMT", "receipt_creation_date_ms": "1562213088000", "receipt_creation_date_pst": "2019-07-03 21:04:48 America/Los_Angeles", "request_date": "2019-09-17 12:40:32 Etc/GMT", "request_date_ms": "1568724032133", "request_date_pst": "2019-09-17 05:40:32 America/Los_Angeles", "original_purchase_date": "2019-07-02 03:47:52 Etc/GMT", "original_purchase_date_ms": "1562039272000", "original_purchase_date_pst": "2019-07-01 20:47:52 America/Los_Angeles", "original_application_version": "28", "in_app": [] }, "status": 0, "environment": "Production" }


                      This happens to 40% of the clients. How can I find out the product or the expiration, if it was renewed?