When I open my app on iOS, even after it being killed, when IAP initializes and I look into the apple receipt, the latest completed transaction is present in there, is that expected behaviour? I use only consumables.
When I make a purchase, it seems to purge the previous transaction and only contain the latest again. I can work with this but wanted to know if that’s expected behaviour(?)
Please describe in your code where you see “the last completed transaction” and specific steps to reproduce and the corresponding runtime Debug.Log output via XCode https://discussions.unity.com/t/700551
#if UNITY_IOS
storedReceiptIOS = builder.Configure<IAppleConfiguration>().appReceipt;
var appleConfig = builder.Configure<IAppleConfiguration>();
var appleReceiptData = System.Convert.FromBase64String(appleConfig.appReceipt);
AppleReceipt appleReceipt = new AppleValidator(AppleTangle.Data()).Validate(appleReceiptData);
Debug.Log("Apple start info:");
Debug.Log(appleReceipt.bundleID);
Debug.Log(appleReceipt.receiptCreationDate);
Debug.Log(appleReceipt.inAppPurchaseReceipts.Length);
foreach (AppleInAppPurchaseReceipt productReceipt in appleReceipt.inAppPurchaseReceipts) {
Debug.Log(productReceipt.productID);
Debug.Log(productReceipt.purchaseDate);
}
#endif
In the Debug.Log statements. appleReceipt.bundleID, appleReceipt.receiptCreationTime and productReceipt.productID and productReceipt.purchaseDate all print to the console (can see in xCode) the information of the last (successful) transaction I did, even after killing the app and restarting. As you can see in my previous post this is all in Start() so right off the bat. This is in ios sandbox.
That is the app receipt which is a receipt bundle and should always contain all receipts, is my understanding. Does it contain two receipts if you make 2 prior purchases?
Since I only have consumables the behaviour makes sense that the last IAP is shown.
BTW @JeffDUnity3D , would you know if the in-app-purchase receipts in AppleReceipts(from Unity IAP) are in order? That the latest transaction would be the first one in the list (index 0) in AppleInAppPurchaseReceipt[ ]?