xtopaydocs

Checkouts

A checkout is a payment page for an amount you set. Create one, send your customer to its URL, and check the payment when they're done.

Live

Checkouts work today, with test and live keys. Every Xtopay pay page uses the same checkout: your customer sees the same thing either way.

MoMo only for now

Card payments are coming soon. For now a checkout offers Mobile Money only: methods with only card is refused, and card in a list is left out.

A checkout is what's to be paid: an amount, what it's for and, if you know them, who's paying. Your customer opens its url (pay.xtopay.co/<id>) and chooses how to pay: Mobile Money (a PIN prompt on their phone) or a bank card (on our payment partner's secure page). When it's paid, they go back to your callback_url.

Create a checkout

POST/v1/checkouts

Prop

Type

curl https://api.xtopay.co/v1/checkouts \
  -H "Authorization: Bearer sk_test_…" \
  -H "Content-Type: application/json" \
  -d '{
    "amount": 350,
    "description": "Jollof party pack",
    "reference": "order_1042",
    "callback_url": "https://yourshop.com/thanks"
  }'

It answers with the checkout:

201 Created
{
  "success": true,
  "data": {
    "id": "chk_8f3k2m9q4z7c1v5xw0bn",
    "url": "https://pay.xtopay.co/chk_8f3k2m9q4z7c1v5xw0bn",
    "mode": "test",
    "amount": 350,
    "currency": "GHS",
    "description": "Jollof party pack",
    "reference": "order_1042",
    "status": "pending",
    "payment": null,
    "customer": { "name": null, "email": null, "phone": null },
    "methods": null,
    "callback_url": "https://yourshop.com/thanks",
    "metadata": {},
    "expires_at": "2026-10-26T09:15:00Z",
    "created_at": "2026-10-25T09:15:00Z"
  }
}

Send your customer to url. It works on phones and computers; there's nothing to embed. A reference used before gets 409 taken.

The checkout's status

StatusMeaning
pendingWaiting for your customer to pay
paidPaid. payment is the payment's reference (XTP-…)
expiredNot paid within 24 hours. Create a new one if they still want to pay

A customer can try more than once on the same checkout, say if their first MoMo prompt timed out, or to switch to a card. While a try is still waiting they can't start another for a couple of minutes, and once one succeeds the checkout is paid and takes no more.

When your customer comes back

Once it's paid, they go to your callback_url with the checkout's ID and your reference:

https://yourshop.com/thanks?checkout=chk_8f3k2m9q4z7c1v5xw0bn&reference=order_1042

If they paid by card on our partner's page, they see their receipt first, with a button back to you. Back on the checkout also goes to your callback_url.

Check before you fulfil

Anyone can open that URL. Before you hand anything over, get the checkout (or wait for the payment.successful webhook) and check that its status is paid and its amount is what you expect.

Its payment is an ordinary payment, with checkout set to the checkout's ID, source.type checkout, and your metadata.

Get a checkout

GET/v1/checkouts/{id}
curl https://api.xtopay.co/v1/checkouts/chk_8f3k2m9q4z7c1v5xw0bn \
  -H "Authorization: Bearer sk_test_…"

List checkouts, or find one by your reference

GET/v1/checkouts

Newest first: reference, status, page and page_size (up to 100). With reference, it's at most one: useful after a retry gets 409 taken.

curl "https://api.xtopay.co/v1/checkouts?reference=order_1042" \
  -H "Authorization: Bearer sk_test_…"

In test mode

A test key's checkouts say Test mode, and both ways to pay go to the test provider's page, where you approve or decline the payment yourself. See Testing.

On this page