Skip to content
xtopay

Developers

In development

Payments in a few lines of code

The Xtopay API will let your product create checkouts and payment links, look up payments, refund and pay out, and hear about every change through signed webhooks.

Create a checkout
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"  }'

The API is in development. What's on this page is a preview of how it will work, and the details may change before it opens.

What it covers

Everything the dashboard does, from your code

  • Checkouts

    Create a checkout for an amount and your order reference, and send the customer to pay.

  • Payment links

    Make, change and pause payment links for your products and invoices.

  • Payments

    Look up any payment, or list them with the same filters as the dashboard.

  • Refunds

    Refund a payment in full or in part.

  • Payouts

    Check your balance and pay out to your MoMo wallet or bank.

  • Webhooks

    Signed messages to your server whenever a payment or payout changes.

A checkout, from your code

Send the amount, get back a page to pay on

Every response comes in the same shape: success, the data, and a message when something needs fixing.

  • Amounts in cedis, with your own order reference
  • Send the customer to the url, on pay.xtopay.co
  • They come back to your callback_url when they're done
Request
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"  }'
Response
{  "success": true,  "data": {    "id": "chk_8f3k2m9q",    "url": "https://pay.xtopay.co/chk_8f3k2m9q",    "amount": 350,    "currency": "GHS",    "reference": "order_1042",    "status": "pending"  }}

Webhooks

Hear about every payment

Add a URL in your dashboard and choose the events you want. Each message is signed with the X-Xtopay-Signature header, so you know it came from Xtopay.

Webhook deliveries

https://yourshop.com/hooks/xtopay

  • 200payment.successful182 ms
  • 200payout.paid240 ms
  • 500payment.failed1210 ms
  • 200payment.refunded164 ms
  • payment.successfulA customer has paid.
  • payment.failedA payment didn't go through.
  • payment.refundedYou refunded a payment, in full or part.
  • payout.paidA payout reached your account.
  • payout.failedA payout couldn't be sent.

Keys

Test first, then go live

Test keys

sk_test_…

A sandbox: try every request and webhook without real money.

Live keys

sk_live_…

Real money from real customers, when you're ready.

Your keys live in the dashboard's Developers section. Roll a key any time, and the old one stops working.

Getting started

From sign-up to your first payment

  1. 1

    Create an account

    Sign up and make your merchant, the same as any business.

  2. 2

    Get your test keys

    Find them in the dashboard's Developers section.

  3. 3

    Build in test mode

    Create checkouts and receive webhooks without real money.

  4. 4

    Go live

    Switch to your live keys and take real payments.

Questions

When can I use the API?
It's in development. Create your account now and your keys will be in the dashboard's Developers section when it opens.
Will there be libraries for my language?
SDKs are planned. Until then, the API is plain HTTPS and JSON, so any language can call it.
How do I know a webhook came from Xtopay?
Every webhook is signed with the X-Xtopay-Signature header, which you check with your webhook secret.
Can I build without coding at all?
Yes. Payment links and the dashboard do everything most businesses need, with no code.