Create Order (On-Ramp Or Off-Ramp)
Creates a new order for buying or selling cryptocurrency (USDT) with fiat currency (KES via mobile money).
Order Flows
On-Ramp Flow (ON_RAMP_BUY)
Customer buys USDT with fiat currency (KES).
1. Customer creates order → Status: "pending"
2. Customer initiates mobile money payment via STK Push
3. System receives mobile money payment confirmation
4. Vendor sends USDT to customer's wallet address
5. Order status → "completed"
Key Points:
- Customer pays fiat first (mobile money)
- Vendor sends USDT to customer’s wallet
- No escrow wallet needed
payout_phonenot required
Off-Ramp Flow (OFF_RAMP_SELL)
Customer 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 mobile money payout to customer
5. Order status → "completed"
Key Points:
- Customer sends USDT to escrow first
- System generates unique escrow wallet per order (dynamic address)
- System sends mobile money payout after deposit confirmation
payout_phoneis requiredwallet_addressis used to detect network (Tron/Ethereum) for escrow generation
Field Requirements
| 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 | mobile money phone number for payout |
status | ⚪ Optional | ⚪ Optional | Defaults: “pending” (on-ramp) or “awaiting_crypto” (off-ramp) |
expires_at | ✅ Required | ✅ Required | Order expiration (RFC3339 format) |
Body
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:
- On-ramp (ON_RAMP_BUY): Address where customer will receive USDT
- Off-ramp (OFF_RAMP_SELL): Used to detect network (Tron if starts with "T", Ethereum otherwise) Must be a valid Tron (TRC20) or Ethereum (ERC20) address.
Payment method for fiat transactions
"mpesa"
Order type determines the transaction flow:
- ON_RAMP_BUY: Customer buys crypto with fiat (mobile money → USDT)
- OFF_RAMP_SELL: Customer sells crypto for fiat (USDT → mobile money)
ON_RAMP_BUY, ON_RAMP_SELL, OFF_RAMP_BUY, OFF_RAMP_SELL Order status. If not provided, defaults to:
- On-ramp: "pending" (waiting for mobile money payment)
- Off-ramp: "awaiting_crypto" (waiting for USDT deposit to escrow)
pending, processing, confirming, completed, cancelled, awaiting_crypto Order expiration timestamp (RFC3339 format, e.g., "2025-12-31T23:59:59Z")
Phone number for receiving mobile money payout (MSISDN format, e.g., "254727648169").
- Required for: OFF_RAMP_SELL orders only
- Not used in: ON_RAMP_BUY orders Format: Country code + number without leading zeros (e.g., 2547XXXXXXXX for Kenya)
Response
Order created
Liquidity provider (publisher). API name vendor_id.
Liquidity listing id. API name offer_id. Nullable for custodial remittance orders.
Backward-compatible alias for crypto_amount
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 Distinguishes standard flows from remittance off-ramp and custodial remittance. Legacy rows are backfilled as
standard_onramp/standard_offramp.
standard_onramp, standard_offramp, remittance_offramp, custodial_remittance_offramp Database-style nullable string wrapper
Database-style nullable string wrapper
Database-style nullable string wrapper
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