Windows Phone In-App Purchase

主宰稳场 提交于 2019-12-11 06:28:41

问题


I am trying to implement in app purchase in my app for windows phone 8 with no luck. I've created a beta app and added an in app purchase product to it. I took the product id from the Beta app and put it in the WMAppManifest.xml file and recompiled. I tried running the app in the emulator and on my device with no luck!

I've titled the product FullVersion for both the alias and in app name;

In my app here's how I am checking the purchase and proceeding with the transaction. It opens the purchase page but says "Can't find item in catalog - We looked but can't find the item you wanted to buy."

    private async void Upgrade_Click(object sender, EventArgs e)
    {

        if (!Store.CurrentApp.LicenseInformation.ProductLicenses["FullVersion"].IsActive)
        {
            ListingInformation li = await Store.CurrentApp.LoadListingInformationAsync();
            string receipt = await Store.CurrentApp.RequestProductPurchaseAsync("FullVersion", false);
        }
    }

回答1:


Basically there are 3 ways of testing In-App purchases:

  1. Create Beta App + Beta products
  2. Use Mock In-App Purchase Library, download here
  3. Setup In-app purchase mock service by using IIS

Taken from: https://channel9.msdn.com/Series/Building-Apps-for-Windows-Phone-8-Jump-Start/Building-Apps-for-Windows-Phone-8-Jump-Start-16-In-App-Purchasing (look for demo@13:30)

More info and code samples: http://msdn.microsoft.com/en-us/library/windowsphone/develop/jj681689(v=vs.105).aspx




回答2:


You cannot "really" test in-app purchases. If you publish an app to the store there is no "connection" to the app you run from Visual Studio when debugging. That is the reason you get the "Can't find item in catalog - We looked but can't find the item you wanted to buy.".

The only way to test in app purchases is to use this mocking library http://msdn.microsoft.com/en-us/library/windowsphone/develop/jj681689(v=vs.105).aspx

Looks like there us a way after all: "Publish an app, then take the Product ID of the published app and add it to the Visual Studio project. This allows the project to use the production in-app purchase products"



来源:https://stackoverflow.com/questions/20846293/windows-phone-in-app-purchase

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!