API reference

Authentication

Base URL, API keys and request format.

The LokiPay API is a JSON REST API served by your own deployment.

Base URL#

text
https://pay.yourshop.com/v1

API keys#

Generate a key in Settings → API keys. It starts with lp_live_ and is shown once — store it in your backend’s secrets. LokiPay keeps only a hash. Rotate creates a new key and the old one stops working immediately. A key can also be set with MERCHANT_API_KEY in the server .env.

Server-side only
The API key gives full access to payments. Never put it in a browser, mobile app or public repository. Customers use the hosted pages, which need no key.

Requests#

bash
curl https://pay.yourshop.com/v1/config \
  -H "Authorization: Bearer lp_live_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
  • Send Content-Type: application/json for request bodies.
  • Amounts are integers in pesewas (GHS 1.00 = 100). Times are ISO 8601 UTC.
  • Errors return a JSON body { "error", "code" } — see errors.

Get configuration#

GET/v1/configAPI key

Returns where customers pay, the matching windows and your branding — useful to show payment details in your own UI.

json
{
  "payTo": { "network": "MTN", "accountName": "Loki Store", "accountNumber": "0241234567", "instructions": "…" },
  "matching": { "refWindowMinutes": 60, "claimTimeoutHours": 6, "claimMaxAgeHours": 72, "claimWindowHours": 72 },
  "brand": { "name": "Loki Store", "primaryColor": "#30D158", "logoUrl": "", "supportUrl": "", "supportLabel": "" }
}