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
currency_codestringYesCurrency (XOF, USD, etc.)
billing_intervalstringNoday, week, month, year (recurring only)
interval_countnumberNoInterval multiplier (default: 1)
is_defaultbooleanNoSet as default price
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.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['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.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

FieldTypeDescription
idstringUnique product identifier
organization_idstringOwning organization
namestringProduct name
descriptionstringProduct description
product_typestringone_time, recurring, usage_based
imagesarrayProduct image URLs
is_activebooleanActive status
display_on_storefrontbooleanStorefront visibility
pricesarrayArray of price objects
metadataobjectCustom metadata
created_atstringCreation timestamp

Error Responses

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

On this page