Auto Renewable Receipt Validation STATUS 0

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.

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.


see:

https://developer.apple.com/library/prerelease/ios/releasenotes/General/ValidateAppStoreReceipt/Chapters/ValidateRemotely.html#//apple_ref/doc/uid/TP40010573-CH104-SW1


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

0
because the receipt as a whole is valid."

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.

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.

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?

vscpaiva,

Are you seeing production receipts with "download_id": 9999 as indicated in your message? I have seen a number of receipts like this as well and am wondering if they are indeed valid. The documentation leads me to believe it is supposed to be a unique identifier.

Thanks,
Jaime
I’m going to suggest that you start a new thread for this issue. This thread was migrated from the old DevForums and doesn’t have the appropriate tags (specifically In-App Purchase).

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@apple.com"
Auto Renewable Receipt Validation STATUS 0
 
 
Q