SKRefreshReceipt latest_receipt_info order of purchases is wrong

My app utilizes auto-renew subscriptions. To check the status I refresh the receipt, validate it with the iTunes servers, and check the expiration date of the last object of "latest_receipt_info"


if let receiptInfo: NSArray = json["latest_receipt_info"] as? NSArray{
let lastReceipt = receiptInfo.lastObject as! NSDictionary
let productid: String = lastReceipt["product_id"] as! String
let bundleid: String = Bundle.main.bundleIdentifier! + ".monthly"
let expirationDate: Date = (formatter.date(from: lastReceipt["expires_date"] as! String) as Date?)!
}


The issue I'm having is that the order of receipts in "latest_receipt_info" is completely wrong. The order is constantly changing. I was having no issues with this until today. Could this be a bug, or am I doing something wrong?

Accepted Reply

> I was having no issues with this until today. Could this be a bug, or am I doing something wrong?


You are relying on the order of receipts being chronologic. It is not.

Replies

> I was having no issues with this until today. Could this be a bug, or am I doing something wrong?


You are relying on the order of receipts being chronologic. It is not.

That answers that. Thanks.