1

I'm trying to enable in-app purchase in my Metro app, but it doesn't seem to be working at all. I'm getting no error, and the return value is an empty string. My code looks like this:

await CurrentAppSimulator.RequestProductPurchaseAsync("bonus", false);
if (!licenseInformation.ProductLicenses["bonus"].IsActive) {
     error="purchase didn't work?";
}

And I get the error. I made sure to have the WindowsStoreProxy.xml file. It looks something like this.

    <Product ProductId="bonus" LicenseDuration="10">
        <MarketData xml:lang="en-us">
            <Name>Bonus pretend feature</Name>
            <Price>1.00</Price>
            <CurrencySymbol>$</CurrencySymbol>
            <CurrencyCode>USD</CurrencyCode>
        </MarketData>
    </Product>
    ...
  <LicenseInformation>
    <App>
        <IsActive>true</IsActive>
        <IsTrial>true</IsTrial>
    </App>
    <Product ProductId="bonus">
        <IsActive>false</IsActive>
    </Product>
  </LicenseInformation>

I think this file's read because if I put "true" under , then my app sees this particular product as purchased. I checked the documentation and it looks like I'm doing everything there.

When the code calls RequestProductPurchaseAsync, I get a dialog asking me to choose a return value. I pick S_OK, then click on Continue. I get an empty string as return value. The thing is, I'm getting the same outcome regardless of the string I put in as the first argument.

I must be missing something. What am I doing wrong? How do I diagnose this thing?

EDIT: Apparently the trick to make this work is to make sure your app isn't in trial mode - which is the default.

But how do diagnose this thing? How do I get error messages when things are going wrong, how do I get this API to tell me helpful errors like "purchase failed because app is in trial mode"?

4

1 回答 1

1

看到我也和其他人在这个问题上发生了争执。我已经实现了代码,我的应用程序也在商店里,没有任何抱怨......我会一步一步解释

1 -> 我希望您熟悉 应用程序购买链接中的代码

2 - >您需要默认使应用程序生效。您无法在试用模式下完成相同的操作……从开发人员机器上运行。

3 -> 一旦这部分代码

await CurrentAppSimulator.RequestProductPurchaseAsync("product1"); 

并在直播时将 currentappsimulator 更改为 currentapp。

在windows store处理的整个过程中执行。

4 -> 如果应用内购买的产品不在商店中(您需要在将应用上传到商店时列出所有应用内购买的产品)它会自动给出产品不存在的错误。

5 - >如果没有信用卡信息,那么它会自己给出一条错误消息..

所有这些都由 Windows 商店处理,您只需要在应用程序内购买所有应用程序即可。现在客户端应用程序(您的应用程序)和 Windows 商店之间的财务交易是什么,我不能说您需要谷歌搜索的任何其他业务中的一些钱。

无法在试用版中使用的原因:如果他们给我们以自己的方式从某些帐户中扣款,那么通过 powershell 文件分发的试用版应用程序甚至会帮助在应用程序购买中进行购买是不正确和合法的: )

上次我停止回答这样的问题时没有人相信我,如果你愿意,你可以继续探索更多。

于 2013-09-05T07:57:24.660 回答