1
votes

I have developed a Windows Universal App for Windows 8.1. This app works as per expectations in the Windows Store (including in app purchases)

I have been facing issues on the Windows Phone Store though. On device (running Windows Phone 8.1) this message : Can't find item in catalog ; We looked but can't find the item you wanted to buy., is displayed when an in app purchase is attempted.

 public sealed partial class MainPage : Page
{
    public event EventHandler<MainPageSizeChangedEventArgs> MainPageResized;

    private String ProductId = "focusmedica.ud.cabg";
    private String[] video = {  "Video1",
                                "Video2",
                                "Video3",
                                "Video4",
                                "Video5"

                             };

    LicenseChangedEventHandler licenseChangeHandler = null;

    public MainPage()
    {
        this.InitializeComponent();
        this.NavigationCacheMode = NavigationCacheMode.Enabled;
        SizeChanged += MainPage_SizeChanged;
    }


     protected override  void OnNavigatedTo(NavigationEventArgs e)
     {
        //await LoadInAppPurchaseProxyFileAsync();

     }  

    protected override void OnNavigatingFrom(NavigatingCancelEventArgs e)
    {

        if (licenseChangeHandler != null)
        {
            CurrentApp.LicenseInformation.LicenseChanged -= licenseChangeHandler;
        }
        base.OnNavigatingFrom(e);
    }       

    public void NotifyUser(string strMessage, NotifyType type)
    {

    }

    private async void BuyProduct2_Click(object sender, RoutedEventArgs e)
    {

        LicenseInformation licenseInformation = CurrentApp.LicenseInformation;
        if (!licenseInformation.ProductLicenses[ProductId].IsActive)
        {
            NotifyUser("Buying Product 2...", NotifyType.StatusMessage);
            try
            {
                await CurrentApp.RequestProductPurchaseAsync(ProductId);
                if (licenseInformation.ProductLicenses[ProductId].IsActive)
                {
                    NotifyUser("You bought Product 2.", NotifyType.StatusMessage);
                    foreach (String s in video)
                    {
                        Button button = (Button)FindControl<Button>(masterHub, s);
                        button.Visibility = Visibility.Collapsed;

                    }
                }
                else
                {

                    NotifyUser("Product 2 was not purchased.", NotifyType.StatusMessage);
                }
            }
            catch (Exception)
            {

                NotifyUser("Unable to buy Product 2.", NotifyType.ErrorMessage);
            }
        }
        else
        {
            NotifyUser("You already own Product 2.", NotifyType.ErrorMessage);

            foreach (String s in video)
            {
                Button button = (Button)FindControl<Button>(masterHub, s);
                button.Visibility = Visibility.Collapsed;

            }
        }
    }

I'm fairly new to Windows Store app development and even newer to Windows Phone development. Any help will be appreciated.

1
Where is the error message being shown?Nahuel Ianni
On the device, right on the app, after the purchase is selected via a button.siddu
I meant where in the code is the error happening :)Nahuel Ianni
Yeah buddy, if I knew that I wouldn't be posting here now, would I? :D Anyways, there is no exception/error being thrown/shown. The app builds clean AFAIK.siddu
Is this happening in the published app or while you're testing/developing it? stackoverflow.com/q/20846293/33051Zhaph - Ben Duguid

1 Answers

0
votes

We have to Check whether In-app products are created correctly on Windows Phone store and also check productId is correct or not.