Xtopay Docs
API Reference

Payments API

Full reference for the Xtopay Payments API endpoints.

Base URL

https://api.xtopay.co/v1

POST /payments

Create a new payment.

Request body

FieldTypeRequiredDescription
amountintegeryesAmount in smallest currency unit
currencystringyesISO 4217 currency code
customerobjectyesCustomer details
customer.emailstringyesCustomer email
customer.namestringnoCustomer full name
customer.phonestringnoE.164 phone (required for mobile money)
customer_idstringnoExisting customer ID (overrides customer)
redirect_urlstringyesURL to redirect after payment
cancel_urlstringnoURL to redirect on cancellation
checkoutobjectnoCheckout customisation
metadataobjectnoKey-value pairs stored on the payment
curl https://api.xtopay.co/v1/payments \
  -u "$CLIENT_ID:$CLIENT_SECRET" \
  -H "Content-Type: application/json" \
  -d '{
    "amount": 5000,
    "currency": "GHS",
    "customer": { "email": "ama@example.com", "name": "Ama Owusu" },
    "redirect_url": "https://yourapp.com/success"
  }'

Response 201

{
  "id": "pay_a1b2c3",
  "amount": 5000,
  "currency": "GHS",
  "status": "created",
  "checkout_url": "https://checkout.xtopay.co/pay/tok_xyz",
  "created_at": "2026-05-24T10:00:00Z"
}

GET /payments/:id

Retrieve a payment by ID.

curl https://api.xtopay.co/v1/payments/pay_a1b2c3 \
  -u "$CLIENT_ID:$CLIENT_SECRET"

GET /payments

List payments with optional filters.

Query parameters

ParameterTypeDescription
limitinteger1–100, default 20
afterstringCursor for next page
statusstringFilter by status
currencystringFilter by currency
customer_idstringFilter by customer
created_afterISO 8601Filter by creation date
created_beforeISO 8601Filter by creation date

POST /refunds

Issue a refund on a succeeded payment.

Request body

FieldTypeRequiredDescription
payment_idstringyesID of the payment to refund
amountintegernoPartial refund amount. Omit for full refund.
reasonstringnocustomer_request | duplicate | fraudulent | other
curl https://api.xtopay.co/v1/refunds \
  -u "$CLIENT_ID:$CLIENT_SECRET" \
  -H "Content-Type: application/json" \
  -d '{ "payment_id": "pay_a1b2c3", "reason": "customer_request" }'

GET /refunds/:id

Retrieve a refund.


GET /refunds

List refunds. Supports same filters as /payments.

On this page