Nami ML

Nami ML Documentation

Welcome to the Nami ML documentation hub. You'll find comprehensive guides and documentation to help you start working with Nami ML as quickly as possible, as well as support if you get stuck. Let's jump right in!

Get Started    

Product Data Objects

A description of the objects containing metadata related to in-app purchase products on different platforms.

NamiSKU is an internal object used by the SDK to store data related to an in-app purchase product. In some parts of the SDK, we expose this object so you can use it in your app.

Android

The NamiSKU object on Android devices has the following fields:

  • skuId - The ID of the SKU, which will match what you set in the Control Center.
  • skuDetails - This is the SkuDetails objects from the Google Play Billing Library. Details can be found in Google's documentation.
  • platform - This will tell you the purchase platform for a SKU.
  • type - The type of SKU. Will tell you if it is a subscription or one-time purchase.

Apple

The NamiSKU object on Apple devices holds some metadata about a SKProduct that can be of further use beyond just the SKProduct object alone.

📘

What is an SKProduct object?

This is part of Apple's StoreKit framework and contains data about an in-app purchase product registered in App Store Connect. Apple's developer documentation can be found here.

The fields in NamiSKU that you can access are:

  • product the original SKProduct that the NamiMetaProduct is based on. This field will always be populated. It contains items like the productIdentifier, a product base price, and a price locale to understand the currency of the price. See the Apple iOS SDK documentation for more information on SKProduct.
  • productIdentifier a quick way to get the same productIdentifier the SKProduct holds.
  • namiProductInfoDict a dictionary that holds metadata about the product passed down from the Nami console, either as part of a paywall or standalone metadata about a product.
  • isPurchased returns true if this product is currently considered purchased.
  • productPurchase any records found in the StoreKit receipt for a purchased product. May be empty if the product has not been purchased, or if the receipt data is not yet known.

React Native

In React Native any event or function that returns a product or an array of products will contain a dictionary with various fields that you may use.

An example of a product dictionary is given below.

{ 
  "localizedDescription": "Test product a year at a time, renewing!",
  "localizedTitle": "Test Product Yearly",
  "localizedMultipliedPrice": "$19.99",
  "price": "19.99",
  "subscriptionGroupIdentifier": "20532094",
  "productIdentifier": "test_product_yearly_subscription",
  "localizedPrice": "$19.99",
  "numberOfUnits": "1",
  "priceLanguage": "en_US",
  "priceCurrency": "USD",
  "priceCountry": "US",
  "periodUnit": "3" 
}

A more detailed description of the various keys is provided below. Any field prefixed by the string localized uses the locale of the user on their device and pulls the relevant localized version of that field from the App Store. For localization to work correctly, you must have set your products up correctly with localization options on the store.

  • localizedDescription: Description for product entered on the store.
  • localizedTitle: Title for product entered on the store.
  • localizedMultipliedPrice: If a product has multiple units, this will be the total price the user pays, calculated by taking the per unit price and multiplying by the number of periods. Localization adds the correct currency symbol. An example would be a weekly rate of $6.93 that comes from 7 units of $0.99 per day.
  • price: Price for the user's store locale as a decimal value.
  • subscriptionGroupIdentifier: For subscription products, the identifier for the subscription group.
  • productIdentifier: The primary identifier for this product on the App store.
  • localizedPrice: Price formatted by the user's locale, using the local currency symbol required. Display of this number should be done in conjunction with the number of units to avoid confusion.
  • numberOfUnits: the number of times this product will occur in a single purchase term.
  • periodUnit: The time period for the unit of purchase. Stored as a string
    • "0": No units used
    • "1": Weekly
    • "2": Monthly
  • priceLanguage: Language and region code for the product from the user's store.
  • priceCurrency: Currency of the user's store for the product.
  • priceCountry: Country code for the user's store.

📘

subscriptionGroupIdentifier

This is only available on Apple iOS 11 and higher.

Flutter

In Flutter any event or function that returns a product or an array of products is represented by following object

class NamiSKU {
  // Description of the product
  final String description;
  // Title of the product
  final String title;
  // The type of SKU.  Will tell you if it is a subscription or one-time purchase.
  final NamiSKUType type;
  // Price for the user's store locale as a decimal value
  final String price;
  // The ID of the SKU, which will match what you set in the Control Center
  final String skuId;
  // Formatted price of the item, including its currency sign
  final String localizedPrice;
  // The number of times this product will occur in a single purchase term.
  final int numberOfUnits;
  // Currency code for price
  final String priceCurrency;
  // The time period for the unit of purchase.
  // not_used, day, weekly, monthly, quarterly, half_year, annual
  final PeriodUnit periodUnit;
  // Language and region code for the product from the user's store
  final String priceLanguage; // iOS only
  // Country code for the user's store
  final String priceCountry; // iOS only
  // If a product has multiple units, this will be the total price the
  // user pays, calculated by taking the per unit price and multiplying
  // by the number of periods. Localization adds the correct currency
  // symbol. An example would be a weekly rate of $6.93 that comes from 
  // 7 units of $0.99 per day.
  final String localizedMultipliedPrice; // iOS only
  // For subscription products, the identifier for the subscription group.
  final String subscriptionGroupIdentifier; // iOS only
}

Updated about a month ago


Product Data Objects


A description of the objects containing metadata related to in-app purchase products on different platforms.

Suggested Edits are limited on API Reference Pages

You can only suggest edits to Markdown body content, but not to the API spec.