iOS In app purchase: server side receipt validation with multiple purchases of consumable products

477 Views Asked by At

Regarding the receipt of IAP consumable products, in the Apple documentation I read: "Information about consumable products is added to the receipt when they’re paid for and remains in the receipt until you finish the transaction. After you finish the transaction, this information is removed the next time the receipt is updated—e.g., the next time the user makes a purchase".

In a server to server receipt validation scenario, suppose the user buys the consumable product "A" and, due to a server outage, the purchase can't be immediately verified and the corresponding transaction is not finished. Then, suppose the user buys again another "A" product while the server is still not working. From what I understand the IAP receipt is unique for all purchases and can be retrieved in this way:

let appStoreReceiptURL = Bundle.main.appStoreReceiptURL,
let receiptData = try Data(contentsOf: appStoreReceiptURL, options: .alwaysMapped);
let receiptString = receiptData.base64EncodedString(options: []);

Now, since the receipt is unique and the first transaction is not finished, is the second purchase appended to the first one in the receipt? When it comes the moment to validate the purchases should I send the same receipt to my server for both validation?

Thank you in advance

0

There are 0 best solutions below