The Xtopay API
Create checkouts from your own site or app, look up payments and refunds, and hear about every change through signed webhooks.
Live
Checkouts (a payment page for an amount you set), direct charges (a MoMo prompt from your server), payment links, payment pages, invoices, payments, customers, transfers (sending money to wallets and bank accounts), payouts and webhooks work today, with IP allowlists on your keys. Refunds are still the design.
With the API, your server creates a checkout for an amount. Your customer pays on Xtopay's checkout page, by MoMo or card, in your colours. Xtopay tells your server it's paid with a webhook, and you check the payment before you hand over the goods.
How a payment flows
Create a checkout from your server with the amount and your own
reference. You get back its url.
Send your customer to the url. They pay on pay.xtopay.co, then come
back to your callback_url.
Get the payment.successful webhook, and check the payment with
GET /v1/payments/{reference} before you fulfil the order. Never trust the
redirect alone: anyone can open a URL.
Basics
| Base URL | https://api.xtopay.co/v1 |
| Authentication | Authorization: Bearer sk_live_… (see Authentication) |
| Format | JSON in, JSON out. Field names are snake_case |
| Amounts | In cedis, as numbers with up to 2 decimals: 350 is GH₵350.00, 12.5 is GH₵12.50 |
| Currency | GHS |
| Times | ISO 8601, in UTC (Ghana's time all year) |
| IDs | Prefixed by type: lnk_ payment links, pgs_ payment pages, ivc_ invoices, cus_ customers, XTP- payment references, XTP-TR- transfers, XTP-PO- payouts, evt_ events |
Responses
Every response has the same envelope. success says whether it worked;
data holds the result; lists add total.
{
"success": true,
"data": {
"id": "chk_8f3k2m9q",
"status": "pending"
}
}{
"success": false,
"message": "Enter an amount of at least GH₵1",
"code": "invalid"
}message is written to show to a person; code is for your code to act on.
See Errors.