Ios – Use in_app or latest_receipt_info for getting latest receipt for auto-renewable iOS 7 style transactions

in-appin-app-purchaseiosserver-sidesubscription

I am trying to verifying that an auto-renewable In App purchase has not expired server side (not on a device).

I am using Apple's Grand Unified Receipt (iOS 7 style transactions). The response returned by Apple contains in_app and latest_receipt_info elements with an array of receipts. The in_app JSON element contains LESS receipts than latest_receipt_info. I was expecting both elements to contain the same number or receipts.

Also, I was expecting that the in_app element would contain ALL the receipts. However, it appears that latest_receipt_info actually contains all the receipts. Apple documentation seems to suggest to use in_app for finding a latest receipt.

I am surprised to see the latest_receipt_info because Apple's Documentation state that this element is
"Only returned for iOS 6 style transaction receipts for auto-renewable subscriptions." (not iOS 7+).

Which JSON element should I iterate to find the latest receipt for auto-renewable iOS 7 style transactions: in_app or latest_receipt_info?

Best Answer

Just wanted to make clear that only the latest_receipt_info field is returning the latest renewed receipt. This is based on what we're actually getting back from Apple.

The relevant documentation is here on page 21.

Although it states that latest_receipt and latest_receipt_info fields are "Only returned for iOS 6 style transaction receipts for auto-renewable subscriptions", we've found that they are being returned in our iOS 7 receipts. The in_app field within the receipt object is also returned with almost identical data, but doesn't contain the latest receipt info, which is the one you care about in the case of an auto-renewal.

Related Topic