lomi.

Products

Manage products, prices, and subscription configurations.

The Products API allows you to manage your product catalog. Products represent items or services you sell, and each product can have up to 3 active prices.

Create a product

Create a product with one or more prices. At least one price is required.

API reference (full request schema): Create product

Essentials:

  • name, product_type (one_time, recurring, usage_based), and a prices array are required.
  • Each price needs amount and currency_code. Recurring products also need billing_interval on the price.
  • Recurring-only fields: trial_enabled, trial_period_days, failed_payment_action, charge_day, first_payment_type: see the API page.
  • Usage-based products: usage_aggregation, usage_unit: see the API page.

Optional metadata for recurring products (via metadata on create/update): subscription_length ("automatic" by default) and fixed_charges (integer number of billing cycles before expiry). These are not top-level API fields; store them in metadata.

Pay what you want (pricing_model: pay_what_you_want, one-time only): minimum_amount is required; amount is the suggested unit price. The server enforces amount >= minimum_amount and optional maximum_amount. Full price fields: Create product.

import { LomiSDK } from '@lomi./sdk';

const lomi = new LomiSDK({
  apiKey: process.env.LOMI_SECRET_KEY!,
  environment: 'live',
});

// One-time product
const product = await lomi.products.create({
  name: 'E-book Bundle',
  description: 'Complete guide collection',
  product_type: 'one_time',
  prices: [
    {
      amount: 25000,
      currency_code: 'XOF',
      is_default: true,
    },
  ],
  display_on_storefront: true,
});

// Subscription product with trial
const subscription = await lomi.products.create({
  name: 'Premium Plan',
  description: 'Monthly premium access',
  product_type: 'recurring',
  prices: [
    {
      amount: 10000,
      currency_code: 'XOF',
      billing_interval: 'month',
      is_default: true,
    },
  ],
  trial_enabled: true,
  trial_period_days: 14,
  failed_payment_action: 'continue',
});

// Pay what you want (one-time only)
const tipJar = await lomi.products.create({
  name: 'Community tip jar',
  product_type: 'one_time',
  prices: [
    {
      pricing_model: 'pay_what_you_want',
      amount: 1000,
      minimum_amount: 500,
      maximum_amount: 5000,
      currency_code: 'XOF',
      is_default: true,
    },
  ],
});

console.log(`Product created: ${product.product_id}`);
from lomi import LomiClient
import os

client = LomiClient(
    api_key=os.environ["LOMI_SECRET_KEY"],
    environment="test"
)

# One-time product
product = client.products.create({
    "name": "E-book Bundle",
    "description": "Complete guide collection",
    "product_type": "one_time",
    "prices": [
        {
            "amount": 25000,
            "currency_code": "XOF",
            "is_default": True
        }
    ],
    "display_on_storefront": True
})

# Pay what you want (one-time only)
tip_jar = client.products.create({
    "name": "Community tip jar",
    "product_type": "one_time",
    "prices": [
        {
            "pricing_model": "pay_what_you_want",
            "amount": 1000,
            "minimum_amount": 500,
            "maximum_amount": 5000,
            "currency_code": "XOF",
            "is_default": True
        }
    ]
})

print(f"Product created: {product['product_id']}")
curl -X POST "https://api.lomi.africa/products" \
  -H "X-API-KEY: $LOMI_SECRET_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "E-book Bundle",
    "description": "Complete guide collection",
    "product_type": "one_time",
    "prices": [
      {
        "amount": 25000,
        "currency_code": "XOF",
        "is_default": true
      }
    ],
    "display_on_storefront": true
  }'

# Pay what you want (one-time only)
curl -X POST "https://api.lomi.africa/products" \
  -H "X-API-KEY: $LOMI_SECRET_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "Community tip jar",
    "product_type": "one_time",
    "prices": [
      {
        "pricing_model": "pay_what_you_want",
        "amount": 1000,
        "minimum_amount": 500,
        "maximum_amount": 5000,
        "currency_code": "XOF",
        "is_default": true
      }
    ]
  }'

List products

API reference: List products, supports isActive, limit, and offset.

const products = await lomi.products.list({
  isActive: true,
  limit: 20,
});
products = client.products.list(isActive=True, limit=20)
curl -X GET "https://api.lomi.africa/products?isActive=true&limit=20" \
  -H "X-API-KEY: $LOMI_SECRET_KEY"

Get a product

API reference: Get product, returns the product with all prices.

const product = await lomi.products.get('prod_abc123...');
console.log(`Default price: ${product.prices.find(p => p.is_default)?.amount}`);
product = client.products.get('prod_abc123...')
curl -X GET "https://api.lomi.africa/products/prod_abc123..." \
  -H "X-API-KEY: $LOMI_SECRET_KEY"

Add a price to a product

API reference: Add price

Products can have a maximum of 3 active prices. You cannot modify existing prices, create a new one instead.

const price = await lomi.products.addPrice('prod_abc123...', {
  amount: 50000,
  currency_code: 'XOF',
  billing_interval: 'year',
});

console.log(`New price added: ${price.price_id}`);

// Pay what you want price
const pwywPrice = await lomi.products.addPrice('prod_abc123...', {
  pricing_model: 'pay_what_you_want',
  amount: 1000,
  minimum_amount: 500,
  maximum_amount: 5000,
  currency_code: 'XOF',
});
price = client.products.add_price('prod_abc123...', {
    "amount": 50000,
    "currency_code": "XOF",
    "billing_interval": "year"
})
curl -X POST "https://api.lomi.africa/products/prod_abc123.../prices" \
  -H "X-API-KEY: $LOMI_SECRET_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "amount": 50000,
    "currency_code": "XOF",
    "billing_interval": "year"
  }'

Set default price

API reference: Set default price

const product = await lomi.products.setDefaultPrice('prod_abc123...', 'price_def456...');
product = client.products.set_default_price('prod_abc123...', 'price_def456...')
curl -X POST "https://api.lomi.africa/products/prod_abc123.../prices/price_def456.../set-default" \
  -H "X-API-KEY: $LOMI_SECRET_KEY"

On this page