Direct charges
Charge a MoMo number from your server. The customer gets a PIN prompt on their phone; there's no page to open and no code to confirm.
Live
Direct charges work with test keys today. Live charges need your business
verified, an IP allowlist on your live key, and MoMo prompts switched on
for Xtopay by our payment partner; until then a live charge answers
503 unavailable.
A direct charge sends a MoMo PIN prompt straight to the customer's phone, for an amount you set. Use it where the customer is already on their phone and you know their number: a USSD menu, a mobile app, an agent's till, a subscription they asked for.
There's no checkout page and no one-time code: the customer's PIN is the check. Nothing is taken unless they approve the prompt on their own phone.
Charge a number
Prop
Type
curl https://api.xtopay.co/v1/charges \
-H "Authorization: Bearer sk_test_…" \
-H "Idempotency-Key: session-8812" \
-H "Content-Type: application/json" \
-d '{
"amount": 25,
"phone": "024 400 1234",
"description": "Airtime top-up",
"client_reference": "session-8812"
}'It answers with the payment, pending while the prompt is
on the customer's phone:
{
"success": true,
"data": {
"reference": "XTP-P23981GGX74F",
"client_reference": "session-8812",
"mode": "test",
"amount": 25,
"currency": "GHS",
"status": "pending",
"method": "mtn",
"customer": { "name": "MoMo customer", "phone": "233244001234", "email": null },
"description": "Airtime top-up",
"source": { "type": "charge", "id": null, "name": "Airtime top-up" },
"metadata": {},
"created_at": "2026-10-24T15:24:10Z",
"paid_at": null
}
}Finding out how it ended
The customer has a little while to answer the prompt. Then:
- A webhook,
payment.successfulorpayment.failed, goes to your endpoints. This is the way to rely on. - Or ask:
GET /v1/payments/{reference}. A pending charge is checked with the network when you ask (at most every 5 seconds).
A charge that isn't approved within 30 minutes fails. If the network later says it was paid, it becomes successful and you get the webhook then.
Live charges
Direct charges skip the checkout page, so a leaked key could send prompts to anyone. Live charges need:
- A verified business. See Verify your business.
- An IP allowlist on your live key, listing your servers' public addresses. Requests from anywhere else are refused. See Authentication.
Each number can be charged 3 times in 10 minutes per business, enough for
a retry, not enough to flood someone's phone. Each key can make 30 charges
a minute. Past either, you get 429 with Retry-After.
Live charges are real payments: they show in your dashboard and balance like any other. Test charges never do.
Testing
With a test key, no prompt is sent and no money moves. A test charge
answers itself a few seconds later: approved, unless the number ends in
000, which declines. Its webhooks are marked "test": true.