public void NamiSetup() { // This is the appID for a Nami test application with already configured products and paywalls, contact Nami to obtain an Application ID for your own application. var namiConfig = NamiConfiguration.ConfigurationForAppPlatformID(NAMI_APP_PLATFORM_ID); // Makes sure when the app is re-run that any stored bypass purchases are cleared out so we can retry purchases // Note this cannot clear out StoreKit sandbox or regular purchases, which Apple controls. // This only clears out purchases made when bypassStoreKit is enabled. NamiPurchaseManager.ClearBypassStorePurchases(); // For testing we'll bypass StoreKit, so you don't have to run the app on a device to test purchases. // You may want to include some ability to toggle this on for testers of your application. namiConfig.BypassStore = true; //Nami recommends setting the log level to Warn for apps on the store. Info may be helpful during development to better understand what is going on. Debug level has a lot of information and is likely only helpful to the Nami support team. namiConfig.LogLevel = NamiLogLevel.Info; Nami.ConfigureWithNamiConfig(namiConfig); //sign in handler not currently being used but could be needed in the future NamiPaywallManager.RegisterSignInHandler((viewController, message, paywall) => { var okAlertController = UIAlertController.Create("Sign In", message, UIAlertControllerStyle.Alert); //Add Action okAlertController.AddAction(UIAlertAction.Create("OK", UIAlertActionStyle.Default, null)); // Present Alert UIApplication.SharedApplication.KeyWindow.RootViewController.PresentedViewController.PresentViewController(okAlertController, true, null); }); //Nami triggers a callback any time there is a change to the state of an entitlement. //In the callback the full list of currently active entitlements is provided. //You can use this to store the state of whether a user has access to premium features locally in your app. NamiPurchaseManager.RegisterPurchasesChangedHandler(changeHandler: (purchases, purchaseState, error) => { foreach (NamiPurchase purchase in purchases) { var expires = purchase.Expires; } }); NamiPaywallManager.RegisterAllowAutoRaisePaywallHandler(() => { return(true); }); }
private void NamiSetup() { // Makes sure when the app is re-run that any stored bypass purchases are cleared out so we can retry purchases // Note this cannot clear out StoreKit sandbox or regular purchases, which Apple controls. // This only clears out purchases made when bypassStoreKit is enabled. NamiPurchaseManager.ClearBypassStorePurchases(); // This is the appID for a Nami test application with already configured products and paywalls, contact Nami to obtain an Application ID for your own application. var namiConfig = NamiConfiguration.ConfigurationForAppPlatformID("002e2c49-7f66-4d22-a05c-1dc9f2b7f2af"); // For testing we'll bypass StoreKit, so you don't have to run the app on a device to test purchases. // You may want to include some ability to toggle this on for testers of your application. namiConfig.BypassStore = true; namiConfig.LogLevel = NamiLogLevel.Warn; Nami.ConfigureWithNamiConfig(namiConfig); NamiPaywallManager.RegisterSignInHandler((viewController, message, paywall) => { var okAlertController = UIAlertController.Create("Sign In", message, UIAlertControllerStyle.Alert); //Add Action okAlertController.AddAction(UIAlertAction.Create("OK", UIAlertActionStyle.Default, null)); // Present Alert UIApplication.SharedApplication.KeyWindow.RootViewController.PresentedViewController.PresentViewController(okAlertController, true, null); Nami.SetExternalIdentifier(TEST_EXTERNAL_IDENTIFIER, NamiExternalIdentifierType.Uuid); }); NamiPurchaseManager.RegisterPurchasesChangedHandler(changeHandler: (purchases, purchaseState, error) => { foreach (NamiPurchase purchase in purchases) { var expires = purchase.Expires; } }); NamiPurchaseManager.IsSKUIDPurchased("nami_monthly"); NamiPaywallManager.RegisterAllowAutoRaisePaywallHandler(() => { return(true); }); }