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.