lomi.

How do I use charges?

Server-initiated charges for an app that must lock one rail. Hosted checkout is the default.

Direct charges are for an app that must lock one rail. Hosted checkout is the default: create a checkout session, the customer picks the method, and a new rail appears without a code change. POST /charge/* collects payment from your server and you build the customer-facing flow yourself.

Switch charges (POST /charge/switch) are not available. They return 503 service_unavailable. Use hosted checkout or lomi. Elements for cards.

Prefer hosted checkout or payment links unless you need a custom mobile-money flow. Direct charges require you to handle pending states and webhooks.

When to use direct charges

Use direct charges when you want to charge quickly and will not reuse the same payment method object for repeat charges, similar to a one-shot orchestrated payment.

RailEndpointCustomer step
WavePOST /charge/waveOpen wave_launch_url or checkout_url from the response
MTNPOST /charge/mtnApprove on their phone; live status starts PENDING
CardPOST /charge/cardMount lomi. Elements with the returned client_secret
Switch (server-side card)POST /charge/switchNot available: use hosted checkout

Reference implementation

The monorepo includes a runnable example:

  • Path: apps/plugins/references/direct-charge-integration-reference
  • Routes: Wave, MTN, card, and webhook verification
  • cURL scripts: curl/create-wave-charge.sh, curl/create-mtn-charge.sh
cd apps/plugins/references/direct-charge-integration-reference
pnpm install && cp .env.example .env
pnpm run dev

Card flow (summary)

  1. POST /charge/card with amount, currency, and customer_id or (customer_email + customer_name).
  2. Mount lomi. Elements with lomi_pk_test_… or lomi_pk_live_… and the returned client_secret.
  3. Listen for PAYMENT_SUCCEEDED webhooks for fulfillment.

Card amounts start at 1 000 F CFA (0.50 EUR/USD). Card numbers never hit your server or the lomi. API.

Mobile money flow (summary)

  1. POST /charge/wave or POST /charge/mtn with amount, currency, and customer phone in E.164 format.
  2. Redirect or instruct the customer per the response.
  3. Before you provide value, confirm the transaction's final status and amount via webhooks or GET /transactions/{id}.

See Mobile money for the full guide.

Wave request fields

POST /charge/wave

FieldTypeRequiredDescription
amountnumberYesAmount in XOF, from 100 up to 5,000,000 inclusive.
currencystringYesMust be XOF.
customerobjectYesCustomer details.
customer.namestringYesFull name.
customer.emailstringNoEmail.
customer.phoneNumberstringNoE.164 phone (for example +2250102030405).
descriptionstringNoCharge description.
successUrlstringNoRedirect after success.
errorUrlstringNoRedirect after failure.
environmentstringNolive or test (defaults to live).

A 201 response includes transactionId, checkoutUrl, and Wave session details. POST /charge/mtn follows the same pattern; see Create MTN charge.

Card endpoints (POST /charge/card, GET /charge/card/{id}, POST /charge/card/{id}/increment, POST /charge/card/{id}/capture, POST /charge/card/{id}/cancel) are in the REST reference. To block a deposit without taking it, set hold to true and follow Card holds. Switch (POST /charge/switch) still returns 503 service_unavailable.

Sandbox scenarios (test key only)

With a test API key, direct Wave and MTN charges auto-complete by default. To test async or failure paths in CI, send X-Scenario-Key:

ValueResult
pendingCharge stays PENDING (no auto-complete)
failed400 error
curl -sS -X POST "https://sandbox.api.lomi.africa/charge/mtn" \
  -H "X-API-KEY: $LOMI_SECRET_KEY" \
  -H "X-Scenario-Key: pending" \
  -H "Content-Type: application/json" \
  -d '{"amount":1000,"currency":"XOF","customer_phone":"+2250700000000"}'

Hosted checkout and card direct charges do not support this header yet. See Simulate errors and Sandbox payments.

lomi. Network

Operators can create direct charges on behalf of connected member accounts:

POST /charge/wave HTTP/1.1
X-API-KEY: lomi_sk_live_operator_...
Lomi-Account: acct_1234567890

See lomi. Network.

Troubleshooting

Use GET /providers to confirm which rails are connected for the organization before calling direct charge endpoints.

SymptomLikely causeFix
Card charge returns 503 service_unavailableCard direct charges are not configured on the API deploymentOps: ensure platform card-payment credentials are set on the API service for the target environment. Merchants do not configure card-processor account keys: card direct charges run on lomi.'s infrastructure.
Wave charge returns 400 about missing Aggregated Merchant IDWave is not fully connected in the dashboardConnect Wave in the dashboard and save the Aggregated Merchant ID for the organization.
Wave charge returns 400 with a Wave edge errorInvalid payload or Wave-side rejectionSend currency: "XOF", nested customer.phoneNumber in E.164, and optional successUrl / errorUrl (camelCase). See Wave.
Card charge returns 400 about customer fieldsMissing reconciliation fieldsInclude customer_id, or both customer_email and customer_name.
Hosted checkout works but direct charge failsDifferent prerequisites per railHosted checkout uses lomi.'s checkout app; direct charges hit /charge/* and require correct payload shape plus provider connection.

Merchants only need lomi_sk_... (server) and lomi_pk_... (Payment Elements). They never configure platform card-payment secrets themselves.

On this page