Question by
ekohn_seismic · Jan 26, 2018 at 07:28 PM ·
iapstorewindows storereceipt
Getting invalid Windows Store receipts
I'm trying to implement IAP in the Windows store, but the receipts Unity is returning to me won't validate. Here's an example receipt I'm receiving:
<?xml version=\"1.0\"?><Receipt Version=\"2.0\" CertificateId=\"A656B9B1B3AA509EEA30222E6D5E7DBDA9822DCD\" xmlns=\"http://schemas.microsoft.com/windows/2012/store/receipt\"><ProductReceipt PurchasePrice=\"USD0\" PurchaseDate=\"2018-01-26T18:55:45.243Z\" Id=\"c683f446-67f0-4b5c-8308-fe650acc8f87\" AppId=\"SonyPicturesTelevision.PlaytheShow_xhagv60wx4y2m\" ProductId=\"Pack_StarterPack_01\" ProductType=\"Durable\" PublisherUserId=\"JAHTYOzCxMy0f7ZyC+0w1LRsK2TdyVscTo8EuzpSODQ=\" MicrosoftProductId=\"7a31d10d-4d6a-4f3e-9f40-0136eb10002d\" MicrosoftAppId=\"7a31d10d-4d6a-4f3e-9f40-0136eb10002d\" ExpirationDate=\"9999-12-31T23:59:59.999Z\" OfferId=\"\" /><Signature xmlns=\"http://www.w3.org/2000/09/xmldsig#\"><SignedInfo><CanonicalizationMethod Algorithm=\"http://www.w3.org/TR/2001/REC-xml-c14n-20010315\" /><SignatureMethod Algorithm=\"http://www.w3.org/2001/04/xmldsig-more#rsa-sha256\" /><Reference URI=\"\"><Transforms><Transform Algorithm=\"http://www.w3.org/2000/09/xmldsig#enveloped-signature\" /></Transforms><DigestMethod Algorithm=\"http://www.w3.org/2001/04/xmlenc#sha256\" /><DigestValue>neMDm4gb4mwS55v8JCi6Qbm6UcuRjcuurxytvMXlENc=</DigestValue></Reference></SignedInfo><SignatureValue>vzdoTgSoxwoIQcBjo8Pav1aw8OcabRJMIEttN3U3l9nxQT5GUpmRVJESqcWjQoVkx7wpnidPZw20JC5mO0a/FEoQAvAhgL2W8Abq14OQaDpmMhgan5yPdjQhZj296BCqAANpcGqdTCXWedku2dSeWEem+e4JY+3L7KZj/ZmM3BgMlacIB01dm7Y/+CQK40+OwUTIWHvqFq+j0XjEw9Z0K3kl53YWob7NievCgo0K9gIZy6RqtKFcWiWOqH3eJD/BAKG1mVjy7XNDz/aipfzJrbFZ7NFJqSqIwROVUfdMzbG2Jv/D6bB92FEf9I4fp+fo98ju5C4yGi+zjp3pFoOiKQ==</SignatureValue></Signature></Receipt>
Notably, the Receipt element is missing the required ReceiptDate and ReceiptDeviceID fields.
The way I'm getting the receipt is as follow:
public PurchaseProcessingResult ProcessPurchase(PurchaseEventArgs args)
{
//Parse Unity receipt JSON for actual Windows Store receipt
var receipt = JsonConvert.DeserializeObject<UnityReceipt>(args.purchasedProduct.receipt);
string windowsReceipt = receipt.payload;
playfab.ValidateReceipt(windowsReceipt, args.purchasedProduct.metadata.localizedPrice, args.purchasedProduct.metadata.isoCurrencyCode, receipt.store, args.purchasedProduct.definition.id);
return PurchaseProcessingResult.Complete;
}
Does anyone know what could be wrong here?
Thank you.
Comment
Answer by tmanninoseismic · Mar 07, 2018 at 10:19 PM
Bumping this - wondering if anyone knows anything as to why that 'ReceiptDate and ReceiptDeviceID' data would be missing from the receipt?
Your answer
![](https://koobas.hobune.stream/wayback/20220612151341im_/https://answers.unity.com/themes/thub/images/avi.jpg)