lomi.
Payments

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 new product with one or more prices. At least one price is required.

Request Body

FieldTypeRequiredDescription
namestringYesProduct name
descriptionstringNoProduct description
product_typestringYesone_time, recurring, or usage_based
imagesarrayNoList of product image URLs
is_activebooleanNoActive status (default: true)
display_on_storefrontbooleanNoShow on storefront (default: true)
pricesarrayYesArray of price objects (see below)
metadataobjectNoCustom key-value pairs
fee_type_idsarrayNoFee type IDs to apply

Recurring Product Fields:

FieldTypeDescription
failed_payment_actionstringAction on failed payment: pause, cancel, retry
charge_daynumberDay of month to charge (1-31)
first_payment_typestringinitial, non_initial, prorated
trial_enabledbooleanEnable trial period
trial_period_daysnumberTrial length in days

Usage-Based Product Fields:

FieldTypeDescription
usage_aggregationstringsum, max, last_during_period, last_ever
usage_unitstringUnit of measurement (e.g., api_calls)

Price Object

FieldTypeRequiredDescription
amountnumberYesPrice amount (smallest currency unit)
currency_codestringYesXOF, USD, EUR
billing_intervalstringNoday, week, month, year (required for recurring products)
pricing_modelstringNostandard (default), pay_what_you_want, or tiered
minimum_amountnumberPWYWRequired when pricing_model is pay_what_you_want
maximum_amountnumberNoOptional upper bound for pay_what_you_want
is_defaultbooleanNoSet as default price
metadataobjectNoOptional metadata on the price

pay_what_you_want requires minimum_amount (and may include maximum_amount). For standard and tiered, omit those unless your integration uses them.

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

const lomi = new LomiSDK({
  apiKey: process.env.LOMI_API_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: 'retry',
});

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

client = LomiClient(
    api_key=os.environ["LOMI_API_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
})

print(f"Product created: {product['product_id']}")
curl -X POST "https://api.lomi.africa/products" \
  -H "X-API-KEY: $LOMI_API_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
  }'

List products

Retrieve all products with optional filtering.

Query Parameters

ParameterTypeDescription
isActivebooleanFilter by active status
limitnumberResults per page (default: 15)
offsetnumberPagination offset (default: 0)
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_API_KEY"

Get a product

Retrieve product details including 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_API_KEY"

Add a price to a product

Add a new price option to an existing product.

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}`);
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_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "amount": 50000,
    "currency_code": "XOF",
    "billing_interval": "year"
  }'

Set default price

Set a specific price as the default for a product.

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_API_KEY"

Product Object

Returned shapes match the API product resource (see OpenAPI Products). Common fields:

FieldTypeDescription
product_idstringUnique product identifier
organization_idstringOwning organization
namestringProduct name
descriptionstring | nullProduct description
product_typestringone_time, recurring, usage_based
imagesarray | nullProduct image URLs
is_activebooleanActive status
display_on_storefrontbooleanStorefront visibility
pricesarrayPrice objects (price_id, amount, currency_code, billing_interval, pricing_model, minimum_amount, maximum_amount, is_active, is_default, metadata, timestamps)
feesarrayAssociated fee rows (when present)
environmentstringtest or live
failed_payment_actionstring | nullRecurring: pause, cancel, retry
charge_daynumber | nullRecurring charge day (1–31)
first_payment_typestring | nullinitial, non_initial, prorated
trial_enabledbooleanTrial enabled
trial_period_daysnumber | nullTrial length
usage_aggregationstring | nullUsage-based products
usage_unitstring | nullUsage-based products
metadataobject | nullCustom metadata
created_atstringCreation timestamp
updated_atstringLast update timestamp

Error Responses

StatusDescription
400Invalid input or max prices exceeded
401Invalid or missing API key
404Product or price not found

On this page