{"id":21548127,"url":"https://github.com/namiml/nami-unity-sdk","last_synced_at":"2026-05-15T23:11:04.183Z","repository":{"id":253864659,"uuid":"601064011","full_name":"namiml/Nami-Unity-SDK","owner":"namiml","description":"Easy Unity subscriptions \u0026 in-app purchases, with powerful no-code paywalls and A/B testing.","archived":false,"fork":false,"pushed_at":"2024-08-19T22:24:34.000Z","size":11878,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-03-16T01:16:37.897Z","etag":null,"topics":["iap","in-app-purchase","paywall","play-billing","storekit","subscription","unity"],"latest_commit_sha":null,"homepage":"https://www.namiml.com","language":"C#","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/namiml.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-02-13T09:41:14.000Z","updated_at":"2024-08-20T17:02:55.000Z","dependencies_parsed_at":"2024-08-20T03:52:36.939Z","dependency_job_id":null,"html_url":"https://github.com/namiml/Nami-Unity-SDK","commit_stats":null,"previous_names":["namiml/nami-unity-sdk"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/namiml%2FNami-Unity-SDK","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/namiml%2FNami-Unity-SDK/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/namiml%2FNami-Unity-SDK/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/namiml%2FNami-Unity-SDK/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/namiml","download_url":"https://codeload.github.com/namiml/Nami-Unity-SDK/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244141573,"owners_count":20404835,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["iap","in-app-purchase","paywall","play-billing","storekit","subscription","unity"],"created_at":"2024-11-24T06:17:34.852Z","updated_at":"2026-05-15T23:10:59.150Z","avatar_url":"https://github.com/namiml.png","language":"C#","funding_links":[],"categories":[],"sub_categories":[],"readme":"![Nami SDK logo](https://cdn.namiml.com/brand/sdk/Nami-SDK@0.5x.png)\n\n# Nami Unity SDK\n\nNami ML gives you everything you need to power your paywall, streamline subscription management, and drive revenue growth through instantly deployable paywalls, precise targeting and segmentation, and enterprise-grade security and scaleability.\n\nYou can use Nami Unity SDK to use bring these Nami features to your Unity app:\n\n* Library of smart paywall templates to choose from, implemented as native Apple and Android UI\n* No-code paywall creator so you can design your own paywall or make instant changes to an existing ones\n* Experimentation engine to run paywall A/B tests so you can improve your conversion rates\n* Optional IAP \u0026 subscription management, so you don't need another solution\n\nNami is simple adopt while giving you the tools you need to improve revenue. Our free tier is generous, and gives you everything you need to get started. [Sign up for a free account](https://app.namiml.com/join/)\n\nGet started by heading over to our [quick start guide](https://learn.namiml.com/public-docs/get-started/quickstart-guide)\n\n\n## Supported platforms\n\n- iOS\n- Android\n\n## Requirements\n\nUnity 2020.3.44f1+\n\n### iOS Requirements\n\n- iOS 13+\n- iPadOS 13+\n- Xcode 12+\n\n### Android Requirements\n\n- Android SDK minimum version 25\n- SDK builds target Android 13 (API version 33)\n- SDK has been built with Java v8 and Kotlin v1.6.10\n\n## Installation\n\n1. Install the package `https://github.com/namiml/com.nami.sdk.git` via the [Unity Package Manager using a Git URL](https://docs.unity3d.com/Manual/upm-ui-giturl.html).\n2. (Android only) Enable `Custom Main Gradle Template` and `Custom Gradle Properties Template` in Project Settings -\u003e Player -\u003e Publishing Settings.\n3. Setup [External Dependency Manager for Unity](https://github.com/googlesamples/unity-jar-resolver/blob/master/external-dependency-manager-latest.unitypackage) and run resolver for your target platform.\n4. (Android only) In Project folder go to Plugin -\u003e Android -\u003e `gradleTemplate.properties` and add the property `android.useAndroidX=true` there.\n\nNow Nami Unity SDK should be ready to use.\n\n## Configuration\n\nIn Unity editor go to `Window` -\u003e `Nami` -\u003e `Edit Settings` and enter your app platform id. You can also provide it later manually in the code during the initialization.\n\n## Usage\n\n### Setup\n\nInitialize the client-side Nami Unity SDK. Required for Nami to see paywalls and campaigns defined on the Nami server.\n\n```\nvar configuration = new NamiConfiguration.Builder().Build();\nNami.Init(configuration);\n```\n\n### NamiConfiguration\n\nClass used to initialize the Nami Unity SDK when an app starts.\n\n#### Parameters\n\n- appPlatformId - the Application Platform ID from the Control Center. Leave this parameter empty to use the Target Platform ID from NamiSettings.\n- bypassStore - when true, transactions will not be sent to the store. This allows for simplified testing in development.\n- logLevel - set the level of logging printed by the SDK for debugging.\n- namiLanguageCode - sets the language used for campaign targeting.\n\n```csharp\nvar appPlatformId = Application.platform == RuntimePlatform.Android ? \"YOUR_ANDROID_KEY_HERE\" : \"YOUR_IOS_KEY_HERE\";\nnew NamiConfiguration.Builder(appPlatformId) // if left null or omitted it will use the key from settings\n    .BypassStore(false)\n    .LogLevel(NamiLogLevel.Warn)\n    .NamiLanguageCode(NamiLanguageCode.EN)\n    .Build();\n```\n\n### Launch\n\nLaunch a live campaign in your app and show the associated paywall.\n\n#### Parameters\n- label - a string matching the label set in the Control Center\n- launchHandler - this can be used to know if the launch succeeded or failed to raise a paywall.\n- paywallActionHandler - use this to monitor user interactions with the paywall raised by this campaign launch. \n\n```csharp\nNamiCampaignManager.Launch();\n```\n\nLabel example:\n\n```csharp\nNamiCampaignManager.Launch(label);\n```\n\nCallback handlers example:\n\n```csharp\nvar launchHandler = new LaunchHandler(() =\u003e\n{\n    // on success\n}, errorMsg =\u003e\n{\n    // on failure\n}, (purchaseState, activePurchases, errorMsg) =\u003e\n{\n    // on purchase changed - for Android only, won't be called on iOS platforms\n});\n\nvar paywallActionHandler = new PaywallActionHandler((namiPaywallAction, sku, errorMsg, purchases) =\u003e\n{\n    // on paywall action\n    // errorMsg, purchases - for iOS only, will always return null on Android platforms\n});\n\nNamiCampaignManager.Launch(label, launchHandler, paywallActionHandler);\n```\n\n### NamiSKU\nObject that contains all the data on a in-app purchase SKU for an App Platform.\n#### Parameters (read only)\n- Name - The name of the product as set in the Nami Control Center.\n- SkuId - The in-app purchase or subscription reference ID from the App Store or Google Play.\n- Product - (Apple only) additional product info from Apple StoreKit.\n- SkuDetails - (GooglePlay only) additional product info from Google Play Billing.\n- Type - indicates subscription or one time purchase.\n\n### NamiCampaign\nThe campaign object represents the live campaigns configured in the Nami Control Center that are available to the device after all campaign filtering and ordering rules are applied.\n#### Parameters (read only)\n- Id (iOS only)\n- Rule (iOS only)\n- Paywall\n- Segment\n- Type (Android only)\n- Value\n\n```csharp\n// returns a list of campaigns that are available to for the device.\n\nvar campaigns = NamiCampaignManager.AllCampaigns();\n```\n\n### Login\nProvide a unique identifier that can be used to link different devices to the same customer in the Nami platform. This customer id will also be returned in any data sent from the Nami servers to your systems as well.\n\nThe ID sent to Nami must be a valid UUID or you may hash any other identifier with SHA256 and provide it in this call.\n#### Parameters\n- withId - a string of the unique customer id in UUID or SHA256 format\n\n```csharp\nNamiCustomerManager.Login(customerId);\n```\n\n### Logout\nDisassociate a device from an external id.\n\n```csharp\nNamiCustomerManager.Logout();\n```\n\n### IsLoggedIn\nReturn if a user is currently logged into the device.\n\n```csharp\nvar isLoggedIn = NamiCustomerManager.IsLoggedIn;\n```\n\n### CustomerJourneyState\nClass representing the state of a customer's subscription journey.\n#### Parameters (read only)\n- FormerSubscriber - indicates if the customer had subscribed in the past.\n- InGracePeriod - indicates the subscription has lapsed due to a payment failure where the platform is still trying to actively recover the payment method and the granted entitlements should still be active.\n- InTrialPeriod - indicates the customer is in a free trial.\n- InIntroOfferPeriod - indicates the customer is in an introductory offer subscription, where their current price is less than the eventual full price.\n- IsCancelled - indicates if the customer used to be a subscriber and cancelled their subscription renewal.\n- InPause - (Android only) indicates if the customer's subscription is paused.\n- InAccountHold - indicates if the subscription has lapsed due to a payment failure and the granted entitlements are no longer active.\n\n```csharp\n// returns the current state of a customer's subscription journey\n\nvar customerJourneyState = NamiCustomerManager.JourneyState;\n```\n\n### Refresh\nManually trigger a refresh of the user's latest active entitlements from the Nami services.\n#### Parameters\n- refreshCallback - returns the entitlements list that can be used for processing.\n\n```csharp\nNamiEntitlementManager.Refresh(RefreshCallback);\n\nvoid RefreshCallback(List\u003cNamiEntitlement\u003e entitlements)\n{\n    // on refresh\n}\n```\n\n### NamiEntitlement\nObject that contains data about an entitlement on the Nami Platform.\n#### Parameters (read only)\n- ActivePurchases - a NamiPurchase object corresponding to the purchase that granted the entitlement. Will contain any general metadata know by the SDK. If the purchase was made on the current device, will contain additional platform-specific data.\n- Desc - the description for the entitlement, set in the Control Center.\n- Name - the name of the entitlement, set in the Control Center.\n- NamiId - an internal id used by Nami for the entitlement.\n- PurchasedSKUs - a list of NamiSKU objects for the purchased in-app products that granted the entitlement. May contain some general metadata about the in-app purchase - product when available. If the entitlement was purchased on device, this object will contain data about the in-app purchase product.\n- ReferenceId - the unique id used to reference the entitlement, set in the Control Center\n- RelatedSKUs - a list of NamiSKU objects. This is the list of all known in-app purchase products that can grant this entitlement. Set in the Control Center.\n\n```csharp\n// returns all active entitlements for a user on the current device\n\nvar activeEntitlements = NamiEntitlementManager.Active();\n```\n\n## Callbacks\nRegister and handle callbacks for your app logic.\n\n### RegisterAvailableCampaignsHandler\nReceive a callback whenever the SDK gets back the current list of available NamiCampaign objects for the device. This list is personalized for the device by the Nami backend server based upon campaign filtering and priority rules.\n\n```csharp\nNamiCampaignManager.RegisterAvailableCampaignsHandler(availableCampaignsCallback);\n```\n\n### RegisterAccountStateHandler\nRegister a callback that will be called whenever `NamiCustomerManager.Login` or `NamiCustomerManager.Logout` is called with results from those calls.\n\n```csharp\nNamiCustomerManager.RegisterAccountStateHandler(accountStateCallback);\n```\n\n### RegisterJourneyStateHandler\nRegister a callback that will be made any time there's a change to the Journey State for the user. Note that Nami fetches journey state at the start of each session and this is the most likely time to see a change.\n\n```csharp\nNamiCustomerManager.RegisterJourneyStateHandler(journeyStateCallback);\n```\n\n### RegisterActiveEntitlementsHandler\nRegister a callback to react to a potential changes to the active entitlements for the user, whenever such state is fetched from the Nami service. This occurs during the course of the application lifecycle as well as when `NamiEntitlementManager.Refresh` is called.\n\n```csharp\nNamiEntitlementManager.RegisterActiveEntitlementsHandler(activeEntitlementsCallback);\n```\n\n### RegisterCloseHandler\nIf this registered, paywall `close` buttons will call back to this handler for your own custom business logic instead of using the system default, which is to just dismiss the paywall.\n\n```csharp\nNamiPaywallManager.RegisterCloseHandler(CloseCallback);\n\nvoid CloseCallback()\n{\n    // code\n\n#if UNITY_IOS\n    NamiPaywallManager.Dismiss();\n#endif\n}\n```\n\n### RegisterSignInHandler\nRegister a sign-in provider to handle your own sign-in logic.\n\n```csharp\nNamiPaywallManager.RegisterSignInHandler(signInCallback);\n```\n\n### RegisterBuySkuHandler\nBy registering this handler, a Nami paywall will handoff to you when the user has selected a sku and asked for the purchase flow to start. It is you're responsible to listen to this handler and handle the purchase using the provided sku.\n\nOnce the purchase is successful, indicate it is complete by calling `NamiPaywallManager.BuySkuComplete`.\n\n```csharp\nNamiPaywallManager.RegisterBuySkuHandler(buySkuCallback);\n```\n\n### RegisterPurchasesChangedHandler\nRegister a callback that will be made anytime there is a change to purchases made on the device. This will be triggered when a purchase process is started and may have different states based on the particular store platform.\n\n```csharp\nNamiPurchaseManager.RegisterPurchasesChangedHandler(purchasesChangedCallback);\n```\n\n### RegisterRestorePurchasesHandler\nFor recommendations on where to present UI elements to your customers during a restore purchases process, see our Restoring Purchases guide.\n\n```csharp\nNamiPurchaseManager.RegisterRestorePurchasesHandler(restorePurchasesCallback); // Apple only\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnamiml%2Fnami-unity-sdk","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnamiml%2Fnami-unity-sdk","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnamiml%2Fnami-unity-sdk/lists"}