Closed samcarrier closed 5 months ago
All of the documentation is the same. It is the same API: https://jamesmontemagno.github.io/InAppBillingPlugin/
Let me know if there is something specific you see that i can clearify up and update.
I was asking specifically for MAUI.
It appears from google search that the syntax is different , from what I've see this needs to be added to MauiProgram class:
Maybe something like this?
public static MauiApp CreateMauiApp()
{
var builder = MauiApp.CreateBuilder();
builder
.UseMauiApp<App>()
.UseMauiCommunityToolkit()
.ConfigureFonts(fonts =>
{
fonts.AddFont("MaterialIconsOutlined-Regular.otf", "IconGoogle");
fonts.AddFont("OpenSans-Regular.ttf", "OpenSansRegular");
fonts.AddFont("OpenSans-Semibold.ttf", "OpenSansSemibold");
})
.ConfigureLifecycleEvents(AppLifecycle => {
#if IOS
AppLifecycle.AddiOS(ios => ios
.FinishedLaunching((del,b) => {Plugin.InAppBilling.InAppBillingImplementation.OnShouldAddStorePayment = OnShouldAddStorePayment;
var current = Plugin.InAppBilling.CrossInAppBilling.Current;})
);
#endif
})
I'm really not sure I'm doing it the right way as there is no example in the sample program either or if it's even needed.
Got it! It is only needed if you are allowing purchases through a promoted item on the app store. If you aren't then it isn't needed at all.
It would look a bit like this;
using Microsoft.Extensions.Logging;
using Microsoft.Maui.LifecycleEvents;
#if IOS
using StoreKit;
#endif
namespace MauiApp4;
public static class MauiProgram
{
public static MauiApp CreateMauiApp()
{
var builder = MauiApp.CreateBuilder();
builder
.UseMauiApp<App>()
.ConfigureFonts(fonts =>
{
fonts.AddFont("OpenSans-Regular.ttf", "OpenSansRegular");
fonts.AddFont("OpenSans-Semibold.ttf", "OpenSansSemibold");
})
.ConfigureLifecycleEvents(AppLifecycle =>
{
#if IOS
AppLifecycle.AddiOS(ios =>
ios.FinishedLaunching((del, b) =>
{
Plugin.InAppBilling.InAppBillingImplementation.OnShouldAddStorePayment = OnShouldAddStorePayment;
var current = Plugin.InAppBilling.CrossInAppBilling.Current;
return true;
}));
#endif
});
#if IOS
bool OnShouldAddStorePayment(SKPaymentQueue queue, SKPayment payment, SKProduct product)
{
//Process and check purchases
return true;
}
#endif
#if DEBUG
builder.Logging.AddDebug();
#endif
return builder.Build();
}
}
In the documentation it is not documented how to initialize with MAUI
I have looked in the GitHub directory : jamesmontemagno/InAppBillingPlugin/tree/master/src/InAppBillingTests/InAppBillingMauiTest/
No where in the project do I see the same kind if initialization talked about in the Getting started page of the doc