简体   繁体   中英

IAP not working on UWP apps for Win10Mobile

I've developed a free UWP app with IAP included.

I developed this app for Windows 10 Mobile. I published an IAP to the store named customBackground , and published my app as well as the IAP to the store.

After both of them has published, I downloaded my published app from the store and try to buy the IAP.

However it returned an system popup saying " This in-app item is no longer availble in MY-APP-NAME ". I don't know why this happened.

There are problems:

  1. When I was trying in debug mode in visual studio using CurrentAppSimulator class, it doesn't popup the purchase state selection on my phone or emulator, but it pops up on desktop version. it only reads the stored state in WindowsStoreProxy.xml.

  2. I've also tried using CurrentApp class in debug/release mode after the IAP is published, but no luck, it returns the same error as the store version.

  3. internet permission in Package.appxmanifest is enabled.

Here's the code in my released app in the store:

private async void buy_Click(object sender, RoutedEventArgs e)
    {
        LicenseInformation licenseInformation = CurrentApp.LicenseInformation;
        if (!licenseInformation.ProductLicenses["customBackground"].IsActive)
        {
            Debug.WriteLine("Buying this feature...");
            try
            {
                await CurrentApp.RequestProductPurchaseAsync("customBackground");
                if (licenseInformation.ProductLicenses["customBackground"].IsActive)
                {
                    var purchaseStat = LocalizedStrings.GetString(LocalizedStringEnum.havePurchased);
                    var b = new MessageDialog(purchaseStat);
                    b.ShowAsync();
                    Debug.WriteLine("You bought this feature.");
                    isIAPValid = true;
                }
                else
                {
                    var purchaseStat = LocalizedStrings.GetString(LocalizedStringEnum.notPurchased);
                    var b = new MessageDialog(purchaseStat);
                    b.ShowAsync();
                    Debug.WriteLine("this feature was not purchased.");

                }
            }
            catch (Exception)
            {
                var purchaseStat = LocalizedStrings.GetString(LocalizedStringEnum.purchaseFailed);
                var b = new MessageDialog(purchaseStat);
                b.ShowAsync();
                Debug.WriteLine("Unable to buy this feature.");
            }
        }
        else
        {
            var purchaseStat = LocalizedStrings.GetString(LocalizedStringEnum.alreadyOwned);
            var b = new MessageDialog(purchaseStat);
            b.ShowAsync();
            Debug.WriteLine("You already own this feature.");
            isIAPValid = true;

        }
    }

Thanks!

Later after one day, I found my iap is working. Seems like a temporary problem, Microsoft does need to improve their store system.

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