Integration journey
Step-by-step path from sandbox account to live payments: keys, integration choice, testing, webhooks, and go-live.
Hosted checkout, payment links, subscriptions, and the other products below all go through the same merchant API. The choice of what to build is independent of how you use lomi.: API, SDK, CLI, or MCP.
In sandbox you can
- Pay with test cards
- Let Wave and MTN auto-complete on test keys
- Send
X-Scenario-Key: pendingorfailedon direct Wave/MTN charges - Forward webhooks with
lomi listen
In live you cannot
- Auto-complete Mobile Money (the customer must approve on device)
- Use test PANs (they only work with test keys)
How to use lomi.
Pick the surface that matches how you work.
Call the HTTP contract directly
POST /checkout-sessions
Use the API when you want the exact request and response, a language without an official SDK, or to compare against OpenAPI. Send your secret key as X-API-Key (LOMI_SECRET_KEY). Idempotency-Key is required on money-moving writes.
Create a sandbox checkout:
curl -sS -X POST "https://sandbox.api.lomi.africa/checkout-sessions" \
-H "X-API-Key: $LOMI_SECRET_KEY" \
-H "Content-Type: application/json" \
-d '{
"amount": 10000,
"currency_code": "XOF",
"title": "Test order",
"success_url": "https://example.com/success",
"cancel_url": "https://example.com/cancel"
}'Open checkout_url from the response and pay with a sandbox test method. Full first-payment path: Make a test payment. Endpoint details: Create checkout session.
Call lomi. from application code
@lomi./sdk
The lomi. SDK is the fastest way to call the lomi. API from your application code, create checkout sessions, manage customers and subscriptions, issue refunds, and verify webhooks, with typed methods and built-in error handling.
This guide uses the TypeScript SDK (@lomi./sdk). The same flow applies to Python, Go, and PHP. Install with npm install @lomi./sdk, set LOMI_SECRET_KEY in .env, then:
const session = await lomi.checkoutSessions.create({
amount: 10000,
currency_code: 'XOF',
title: 'Premium subscription',
success_url: 'https://example.com/success',
cancel_url: 'https://example.com/cancel',
});
console.log('Redirect to:', session.checkout_url);lomi init can write the SDK client, example files, and your .env automatically. Full walkthrough: Get started with the SDK. Language references: SDKs.
Work from the terminal
lomi checkout create
The lomi. CLI is the fastest way to authenticate, create test checkouts, listen for webhooks without ngrok, and install AI agent rules, all from your terminal.
Requires Node.js 18+ (used only to download the native binary):
npm install -g lomi.cli
lomi login
lomi quickstart
lomi checkout create \
--amount 10000 \
--currency XOF \
--success-url https://example.com/success \
--cancel-url https://example.com/cancel \
--jsonOpen the checkout_url from the JSON response. Forward webhooks with lomi listen http://localhost:3000/webhooks. lomi login stores a CLI token. lomi init writes your secret API key (LOMI_SECRET_KEY) for the SDK. These are different credentials. Full walkthrough: Get started with the CLI. Command reference: CLI.
Let an AI client call the merchant API
lomi_checkout
The Model Context Protocol (MCP) lets AI assistants (Cursor, Claude Desktop, custom agents) call the lomi. merchant API for you: create checkouts, list payments, debug webhooks, without writing every HTTP request by hand.
Recommended for Cursor / Claude / VS Code: add the hosted MCP URL with no API key. OAuth-capable clients open Connect with lomi. in the browser:
{
"mcpServers": {
"lomi.": {
"url": "https://mcp.lomi.africa/mcp"
}
}
}Then ask the client to create a checkout session (lomi_checkout, action=create). Merchant tools follow lomi_<resource> with a required action. In the dashboard: Settings → Connectors, then Developers → API keys → Connect MCP. Full guide: MCP for AI clients.
Step 1: Create a developer account
Sign up for a lomi. account to access the test environment, where you can run full payment flows without moving real money.
In test mode you can:
- Accept payments using test card numbers and simulated mobile money.
- Create checkout sessions, payment links, and direct charges against the sandbox API.
- Receive webhooks with
"environment": "test"on payloads.
See Create your account and API keys.
Step 2: Choose your integration
lomi. supports multiple integration options depending on your stack:
| If you need | Start with |
|---|---|
| A complete checkout page | Hosted checkout |
| Checkout embedded on your site | Embed checkout widget |
| A shareable URL | Payment links |
| Tickets or appointments | Event bookings |
| A backend-created payment request | Payment requests |
| Server-initiated mobile money or embedded cards | Direct charges |
| Recurring billing | Subscriptions via checkout or links |
| Store plugin (WooCommerce, Shopify, etc.) | E-commerce extensions |
Define what you sell in Products before you create checkout sessions or subscription plans.
Most teams should start with hosted checkout. Use Which integration to choose? and Payment channels to confirm Wave, MTN, and card coverage for your markets.
Step 3: Test end-to-end
Test your integration thoroughly using sandbox credentials:
- Make a test payment: CLI or API checkout session.
- Use Sandbox payments for test cards, Wave, and MTN behavior.
- Exercise failure paths with Simulate errors.
- Fix issues using Error handling and Idempotency keys.
- For checkout edge cases (subscriptions, trials, pending mobile money), see Checkout behavior and per-channel guides under Payment channels.
The same first checkout can be created from REST, SDK, CLI, or MCP. The CLI and cURL paths are spelled out in Make a test payment. The SDK and MCP paths are in Get started with the SDK and MCP.
Step 4: Configure webhooks
Webhooks are especially useful for payment methods and events that happen outside your application's control, such as mobile money approval and subscription renewals.
- Register an HTTPS endpoint in the dashboard.
- Follow Setting up webhooks and Handling webhooks.
- Verify signatures from the raw request body before you parse JSON.
Subscription renewals: Card subscriptions renew off-session; listen for SUBSCRIPTION_RENEWED and renewal PAYMENT_FAILED. Wave and MTN subscriptions use a manual renewal checkout link sent before each billing date, the customer must pay that link; there is no silent wallet debit. See Subscriptions: Renewals.
Step 5: Go live
When sandbox flows work end to end:
- Complete account verification and payout setup.
- Switch servers to
lomi_sk_live_...andhttps://api.lomi.africa. - Follow What to check before live? and process one small live payment with webhook verification.