Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

In-App purchase trouble on Windows 10 UWP

I'm trying to enable an in-app purchase item on my app (already on Windows 10 store), but I always receive the same error message when trying to buy this item:

This in-App Purchase item is no longer available in MyAppName

This in-App Purchase item is no longer available in MyAppName

The code is fairly simple and just what the docs recommend:

var itemName = "app.advanced_items.full";
if (CurrentApp.LicenseInformation.ProductLicenses[itemName].IsActive) {
    return true;
}
var results = await CurrentApp.RequestProductPurchaseAsync(itemName);

if (results.Status == ProductPurchaseStatus.Succeeded ||
    results.Status == ProductPurchaseStatus.AlreadyPurchased) {
    return true;
} else { 
    return false;
}

More information:

  • I created and submited the in-app item to the store before building the package as the documentation told me
  • The name of the item is the same both on the store and the app (itemName on code)
  • I tried this before submitting to the store
  • I tried this after submitting to the store (My app is currently broken there! -- unable to buy the item)

I suspect the problem might be related with the following:

  • The app display name (on Package.appxmanifest) is not the same app name on the store (The name I wanted was not available so I made it longer, but the app once installed will display the original name). This shorter name is the one in the error message...

I changed the "display name" to the full name of the app, but the error was the same. I don't know if sending it to the store might change this (I and don't want to deploy another buggy version just to test this theory)

Extra: The only resources I found online about this issue were useless and related to Windows 8: link

Suggestions?

like image 844
JBernardo Avatar asked Dec 21 '15 18:12

JBernardo


People also ask

How do I enable in app purchases in Windows 10?

Open Microsoft Store and select Profile next to the search box. Select App settings > Purchase sign-in. Turn the switch to On.

Are all apps in Windows Store UWP?

All apps ARE NOT necessarily UWP apps. Windows 8.1 apps do run on Windows 10, just not the other way around. Not every company or indie developer has updated their apps to support UWP. All apps that were previously in the store for Windows Phone 8.1 and Windows 8.1 will still run and be available respectively.

How do I release UWP app?

In Solution Explorer, open the solution for your UWP app project. Right-click the project and choose Publish->Create App Packages (before Visual Studio 2019 version 16.3, the Publish menu is named Store). If this option is disabled or does not appear at all, check that the project is a Universal Windows project.


2 Answers

After 2 months talking to Microsoft support they finally fixed something on their side and my IAP started working.

I believe the fix was global, but if your IAP still do not work, contact them to republish it.

Below is an excerpt from the email they sent me:

We have issued a republish for your IAPs in this app. This should correct the situation as soon as the process completes. You may want to check periodically over the next few hours to see if you are able to confirm the fix worked for you. Let me know what you see.

like image 98
JBernardo Avatar answered Oct 02 '22 14:10

JBernardo


Please check with the productId of the IAP. I guess the one you mention in your code is different from the one in the store.

If its the same, I recommend to use the method LoadListingInformationAsync which returns the list of IAP's and then select the required IAP from that list. If there's a name mismatch then you wont be able to retrieve that IAP. So we'll be able to find its because of the naming problem. I have also added a sample code for that. Give a try.

        try
        {
            var listing = await CurrentApp.LoadListingInformationAsync();
            var iap = listing.ProductListings.FirstOrDefault(p => p.Value.ProductId == "removeads");
            receipt = await CurrentApp.RequestProductPurchaseAsync(iap.Value.ProductId, true);
            if (CurrentApp.LicenseInformation.ProductLicenses[iap.Value.ProductId].IsActive)
            {
                CurrentApp.ReportProductFulfillment(iap.Value.ProductId);
                //your code after purchase is successful
            }
        }
        catch (Exception ex)
        {
            //exception 
        }
like image 23
Razor Avatar answered Oct 02 '22 15:10

Razor