Xtopay Docs
API Reference

Wallets API

Full reference for the Credit Wallets endpoints.

POST /wallets

Create a wallet for a customer.

FieldTypeRequiredDescription
customer_idstringyesCustomer to issue the wallet to
currencystringyesISO 4217 currency code
metadataobjectno
curl https://api.xtopay.co/v1/wallets \
  -u "$CLIENT_ID:$CLIENT_SECRET" \
  -H "Content-Type: application/json" \
  -d '{ "customer_id": "cus_abc123", "currency": "GHS" }'

Response 201

{
  "id": "wal_a1b2c3",
  "customer_id": "cus_abc123",
  "currency": "GHS",
  "balance": 0,
  "balance_formatted": "GH₵0.00",
  "status": "active",
  "created_at": "2026-05-24T10:00:00Z"
}

GET /wallets/:id

Retrieve a wallet by ID.


GET /wallets

List wallets. Filter with ?customer_id=, ?currency=, ?status=.


POST /wallets/:id/freeze

Freeze a wallet. Blocks debits but allows top-ups.


POST /wallets/:id/unfreeze

Unfreeze a wallet.


POST /wallets/:id/close

Close a wallet permanently.


POST /wallets/:id/debit

Deduct funds from a wallet.

FieldTypeRequiredDescription
amountintegeryesAmount to deduct in smallest unit
descriptionstringyesHuman-readable reason for the debit
referencestringyesYour unique reference — used for idempotency
metadataobjectno
curl https://api.xtopay.co/v1/wallets/wal_a1b2c3/debit \
  -u "$CLIENT_ID:$CLIENT_SECRET" \
  -H "Content-Type: application/json" \
  -d '{
    "amount": 500,
    "description": "10 SMS messages sent",
    "reference": "sms_batch_8821"
  }'

Response 200

{
  "id": "txn_a1b2c3",
  "type": "debit",
  "amount": 500,
  "balance_before": 15000,
  "balance_after": 14500,
  "reference": "sms_batch_8821"
}

POST /wallets/:id/credit

Apply an admin credit (no payment required).

FieldTypeRequiredDescription
amountintegeryesAmount to credit
descriptionstringyesReason for the credit
referencestringyesUnique reference
expires_atISO 8601noWhen this credit expires

POST /wallets/:id/topups

Create a top-up checkout for the customer.

FieldTypeRequiredDescription
amountintegeryesAmount the customer will pay
redirect_urlstringyesRedirect after successful payment
cancel_urlstringnoRedirect on cancellation

Response includes checkout_url to redirect the customer.


GET /wallets/:id/topups

List top-ups for a wallet.


GET /wallets/:id/transactions

List all transactions (debits, credits, top-ups, expiries) for a wallet.

ParameterDescription
typeFilter: topup | debit | credit | expiry
limit1–100, default 20
afterCursor

On this page