简体   繁体   中英

Testing Windows store in-app purchases

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

So is there any other way, other than actually buying the product (consumable), to get a receipt?

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 or CurrentApp.RequestProductPurchaseAsync (or one of the other overloads of this method), the return value contains the receipt or call the CurrentApp.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 .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM