API Documentation

Overview

The Xdigitex Pay REST API lets you accept and manage payments programmatically. All requests must include your API key in the X-API-Key header.

Base URL

https://pay.xdigitex.space/api

Authentication

Include your API key in every request header:

X-API-Key: xpay_live_xxxxxxxxxxxxxxxx

Generate API keys from your dashboard.

POST /payments/initiate

Create a new payment and receive a checkout URL.

Request Body

{"amount": 1000, "currency": "KES", "method": "card", "email": "customer@example.com", "phone": "+254712345678", "description": "Order #1234", "callback_url": "https://yoursite.com/callback"}

Response

{"success": true, "reference": "TXN-20240101-ABCD", "checkout_url": "https://pay.xdigitex.space/checkout?ref=TXN-20240101-ABCD", "expires_at": "2024-01-01T12:30:00Z"}
GET /payments/{reference}/status

Get the current status of a payment.

Response

{"reference": "TXN-20240101-ABCD", "status": "completed", "amount": 1000, "fee": 120, "net": 880, "currency": "KES", "method": "card", "paid_at": "2024-01-01T12:15:00Z"}
GET /payments

List all payments with optional filters.

Response

{"data": [...], "total": 42, "per_page": 20, "current_page": 1}
GET /balance

Get wallet balances across all currencies.

Response

{"balances": [{"currency": "KES", "balance": 12500.00, "locked": 0}, {"currency": "USD", "balance": 95.50, "locked": 0}]}
POST /withdrawals

Request a withdrawal. Requires approved KYC.

Request Body

{"amount": 5000, "currency": "KES", "method": "mobile_money", "account_number": "+254712345678"}

Response

{"success": true, "reference": "WDR-20240101-EFGH", "status": "pending", "message": "Withdrawal submitted for admin approval"}
GET /withdrawals

List withdrawal history.

Response

{"data": [...], "total": 5, "per_page": 20}

Payment Methods

Card / Bank Transfer

method: "card"

KES, USD, CDF

Mobile Money

method: "mobile"

KES, CDF

Crypto

method: "crypto"

USD equivalent

Fee Schedule

Method Fee
Card payment12%
Mobile money payment12%
Crypto payment12%

All fees are deducted from the gross amount. Net amount is credited to your wallet.

Webhook Events

Xdigitex Pay sends webhook notifications to your callback URL on payment events.

// Payment completed webhook payload
{"event": "payment.completed", "reference": "TXN-...", "status": "completed", "net_amount": 880, "currency": "KES"}