Accept payments

Hosted checkout

Send customers to a LokiPay page for API payments.

When your backend creates a payment with POST /v1/intents, the response includes a checkoutUrl. Redirect the customer there — LokiPay shows the payment instructions, waits for the MoMo SMS, handles “I have paid”, and shows the receipt. This replaces the old lokipay-sdk React widget.

POST /v1/intents → response (excerpt)
{
  "id": "cmvymj4a1000621twmsz5y6i5",
  "shortRef": "Q9N2LPU7",
  "status": "PENDING",
  "expectedAmountPesewas": 15000,
  "checkoutUrl": "https://pay.yourshop.com/checkout/cmvymj4a1000621twmsz5y6i5",
  "payTo": { "network": "MTN", "accountName": "Loki Store", "accountNumber": "0241234567", "instructions": "…" }
}

Two ways to integrate#

Hosted checkoutYour own UI
Show instructionsLokiPay pageUse payTo and shortRef from the response
Know it’s paidWebhook (recommended) or pollWebhook, or poll GET /v1/intents/:id
“I have paid”Built inCall POST /v1/intents/:id/claim
Never trust the browser alone
Fulfil the order when your server receives a verified payment.verified webhook (or fetches the payment and sees VERIFIED) — not because the customer came back to your site.

Checkout page states#

  • Waiting for payment — instructions plus a countdown for the reference auto-match window.
  • Checking — the customer submitted a Transaction ID; waiting for the SMS.
  • Under review — an admin will decide; the customer is told not to pay again.
  • Payment confirmed — receipt with Transaction ID and time. If you passed returnUrl when creating the payment, the customer is sent back to your site after a short countdown.
  • Cancelled / could not be confirmed — for cancelled or rejected payments.