Hello I am making a web service, which will validate windows store in-app purchases using a receipt from the app. I found this link in microsoft website https://msdn.microsoft.com/en-us/windows/uwp/monetize/use-receipts-to-verify-product-purchases it shows an example code to test with provided receipt data. My web service works with the example data. Now, while the mobile app is still in development I want to test the web service with a real receipt. So is there any other way, other than actually buying the product (consumable), to get a receipt? As I read around the only other way to test purchases is to use windows.applicationModel.Store.CurrentAppSimulator static class. But it uses a locally generated WindowsStoreProxy.xml, but in this case:
- The app has to work
- I could not find information whether it actually queries the Windows store or just uses the dummy data
No, even if you use
CurrentAppSimulator
class, you will still get the receipt not associated with the Store.The only option is to publish your app and IAP product. Then you can make a purchase by using
CurrentApp.RequestAppPurchaseAsync
orCurrentApp.RequestProductPurchaseAsync
(or one of the other overloads of this method), the return value contains the receipt or call theCurrentApp.GetAppReceiptAsync
method to retrieve the current receipt info for your app and any add-ons in your app.I would like to suggest you to create a simple app and publish it first with hidden availability and create add-on product within it. Then you can use the methods above to request for receipt. After complete testing your web service, you can update it with your official mobile app package and make it available to public or just delete it as you expect.
For more details, you may refer to Use receipts to verify product purchases.