I am currently implementing in-app purchases in an app that I am working for Windows 8.
After reading the documentation:
- Request the license Information for the app: msdn.microsoft.com/en-us/library/windows/apps/windows.applicationmodel.store.licenseinformation.aspx
This tells you if the app is trial or not, and the list of products bought using in-app.
- To perform a purchase you need to use the objects:
CurrentApp: In live environment. This will only work when the app is APPROVED in the store, so you need to make this change before packaging to submit to the store.
CurrentAppSimulator: Debug and testing.
2.a. If you are running an app in trial mode, you purchase the app calling: CurrentApp.RequestAppPurchaseAsync (true)
The parameter is requesting to get a string that contains XML that represents all receipts for the app and any in-app purchases. If includeReceipt is set to false, this string is empty.
2.b. Validate a purchase from your servers. Reference
We want to verify that the receipt that we got from server 2.a is genuine. To verify a receipt's authenticity, you can check the receipt's signature using the public certificate. To get this certificate, use the following URL: go.microsoft.com/fwlink/?LinkId=246509&cid= where is the CertificateId of the receipt.
This is a real Receipt from the CurrentAppSimulator:
<?xml version="1.0" encoding="utf-8"?>
<Receipt Version="1.0" ReceiptDate="2012-08-23T14:21:40Z" CertificateId="" ReceiptDeviceId="9d6b1f28-cab8-421f-8f8d-23df2dc3abbe">
<ProductReceipt Id="d9437a12-4f91-4ef0-b0bf-527ab9da2ec9" AppId="Zolmo.JamiesRecipes_40cj6885yhw56" ProductId="JMPK_0004" PurchaseDate="2012-08-23T14:21:40Z" ProductType="Durable" />
</Receipt>
No CertificateId, how could I implement the server side validation? how can I test all this without having an app in the Store?
Thanks, Pedro