lomi.

How do I simulate errors and edge cases?

Test declines, authentication challenges, async mobile money, and webhook failures before go-live.

Use this index to exercise failure paths in sandbox. Full test card numbers and MoMo behavior live in Sandbox payments-this page routes you to the right scenario.

Run these scenarios only with test API keys (lomi_sk_test_...). Never use test card numbers in live mode.

Scenario matrix

ScenarioHow to triggerExpected outcomeLearn more
Card approved4242 4242 4242 4242 on hosted checkoutcompleted, test balance creditSandbox payments: cards
Card declinedDecline test PANs in sandbox tablefailedSame section
3D Secure / authenticationAuth-required test cardsrequires_action or challenge UISandbox payments
Wave (test)Select Wave on sandbox checkoutOften immediate completedWave
MTN MoMo (test)POST /charge/mtn with test MSISDNImmediate completed on test keyMTN MoMo
Direct MoMo pending (test)X-Scenario-Key: pending on POST /charge/mtn or /charge/waveCharge stays PENDING; no auto-completeSandbox payments: scenarios
Direct MoMo failed (test)X-Scenario-Key: failed on POST /charge/mtn or /charge/wave400 error responseSame section
MTN MoMo (live)Real MSISDN, live keyStarts PENDINGVerify payments
Pending expirationWait beyond session/transaction TTLexpired or failedPayment state machine
Webhook signature failurePOST without valid X-Lomi-SignatureYour endpoint returns 4xx; lomi. retriesHandling webhooks
Duplicate webhookReplay same event idYour handler dedupes; no double fulfillWebhook reliability
Insufficient balance payoutTest payout rules in sandbox400 or failed payoutPayouts in test mode
Invalid API keyOmit or wrong X-API-Key401Authentication
Rate limitBurst requests in test429Error handling

Direct charge scenarios (test key only)

On POST /charge/mtn and POST /charge/wave, send X-Scenario-Key to override default test behavior. This applies to direct charges only-hosted checkout and card charges do not read this header yet.

Header valueBehavior
(omit)Default: test charge auto-completes and credits test balance
pendingCharge remains PENDING; no auto-complete (poll or webhook)
failedRequest fails with 400
# Keep charge pending (CI / dunning tests)
curl -sS -X POST "https://sandbox.api.lomi.africa/charge/mtn" \
  -H "X-API-KEY: $LOMI_TEST_KEY" \
  -H "X-Scenario-Key: pending" \
  -H "Content-Type: application/json" \
  -d '{"amount":1000,"currency":"XOF","customer_phone":"+2250700000000"}'

# Simulate provider failure
curl -sS -X POST "https://sandbox.api.lomi.africa/charge/wave" \
  -H "X-API-KEY: $LOMI_TEST_KEY" \
  -H "X-Scenario-Key: failed" \
  -H "Content-Type: application/json" \
  -d '{"amount":1000,"currency":"XOF","customer_phone":"+2250700000000"}'

Automation

For CI and integration tests, see Testing guide and use sandbox curl recipes in Sandbox payments.

On this page