Creates a new order for buying or selling cryptocurrency (USDT) with fiat currency (KES via M-Pesa).
Customer buys USDT with fiat currency (KES).
1. Customer creates order → Status: "pending"
2. Customer initiates M-Pesa payment via STK Push
3. System receives M-Pesa payment confirmation
4. Vendor sends USDT to customer's wallet address
5. Order status → "completed"
Key Points:
payout_phone not requiredCustomer sells USDT for fiat currency (KES).
1. Customer creates order → Status: "awaiting_crypto"
└─ System generates unique escrow wallet address
2. Customer sends USDT to escrow wallet address
3. System detects deposit → Status: "crypto_received"
4. System initiates M-Pesa payout to customer
5. Order status → "completed"
Key Points:
payout_phone is requiredwallet_address is used to detect network (Tron/Ethereum) for escrow generation| Field | On-Ramp | Off-Ramp | Notes |
|---|---|---|---|
customer_id | ✅ Required | ✅ Required | Customer UUID |
vendor_id | ✅ Required | ✅ Required | Vendor UUID |
offer_id | ✅ Required | ✅ Required | Offer UUID |
usdt_amount | ✅ Required | ✅ Required | Amount in USDT |
fiat_amount | ✅ Required | ✅ Required | Amount in fiat currency |
fiat_currency | ✅ Required | ✅ Required | Currency code (e.g., KES) |
wallet_address | ✅ Required | ✅ Required | Customer’s wallet (on-ramp: receives USDT, off-ramp: detects network) |
payment_method | ✅ Required | ✅ Required | Payment method (e.g., mpesa) |
order_type | ✅ Required | ✅ Required | ON_RAMP_BUY or OFF_RAMP_SELL |
payout_phone | ❌ Not used | ✅ Required | M-Pesa phone number for payout |
status | ⚪ Optional | ⚪ Optional | Defaults: “pending” (on-ramp) or “awaiting_crypto” (off-ramp) |
expires_at | ✅ Required | ✅ Required | Order expiration (RFC3339 format) |
Customer UUID who is placing the order
Vendor UUID offering the trade
Offer UUID that this order is based on
Amount of USDT in the order (e.g., "1200.00")
Equivalent fiat amount (e.g., "175200.00")
Fiat currency code (e.g., "KES")
"KES"
Customer's wallet address. Used differently based on order type:
Payment method for fiat transactions
"mpesa"
Order type determines the transaction flow:
ON_RAMP_BUY, ON_RAMP_SELL, OFF_RAMP_BUY, OFF_RAMP_SELL Order status. If not provided, defaults to:
pending, processing, confirming, completed, cancelled, awaiting_crypto Order expiration timestamp (RFC3339 format, e.g., "2025-12-31T23:59:59Z")
Phone number for receiving M-Pesa payout (MSISDN format, e.g., "254727648169").
Order created
pending, processing, confirming, completed, cancelled, failed e.g., mpesa
Database-style nullable string wrapper
Database-style nullable string wrapper
Database-style nullable time wrapper
Database-style nullable time wrapper
Database-style nullable string wrapper
Database-style nullable string wrapper
Database-style nullable string wrapper
Database-style nullable string wrapper
ON_RAMP_BUY, ON_RAMP_SELL, OFF_RAMP_BUY, OFF_RAMP_SELL Database-style nullable string wrapper
Database-style nullable string wrapper
Database-style nullable string wrapper
Database-style nullable string wrapper
Database-style nullable time wrapper