OnLink
API reference

Create a buy order (KES in, USDT out)

Consumes a buy quote and returns the payment instructions — where to send the KES, how much, by when, and the payment reference we issue for this order. The reference is ours, not yours: that is what makes attribution exact rather than guessed. Delivery is asynchronous: nothing is sent until your payment is received and the order reaches a terminal state. Register a webhook endpoint rather than assuming a create means the trade is done. Retry-safe: creating twice with the same partnerReference returns the original order rather than a second one. On the mpesa rail the reference cannot be transmitted (M-PESA carries no narration field), so keep it in your own records — we attribute a Pay Bill payment by the Account Number plus the amount. On the bank rails, put it in the narration.

POST
/v1/orders/buy

Authorization

partner-key
X-OnLink-Key<token>

In: header

Request Body

application/json

TypeScript Definitions

Use the request body type in TypeScript.

Response Body

application/json

application/json

application/json

application/json

application/json

application/json

application/json

curl -X POST "https://example.com/v1/orders/buy" \  -H "Content-Type: application/json" \  -d '{    "quoteId": "string",    "partnerReference": "string",    "walletId": "string",    "paymentRail": "mpesa"  }'
{  "orderId": "9c1e4b07-6d52-4a83-91fe-40ab72c5d318",  "status": "awaiting_payment",  "kesAmount": "1281000.00",  "usdtAmount": "10000.000000",  "rate": "128.1000",  "expiresAt": "2026-09-02T09:30:00.000Z",  "paymentInstructions": {    "rail": "mpesa",    "paybill": "444174",    "payTo": "46013001348902",    "beneficiaryName": "ONLINK MASTER_PESASWAP",    "reference": "OL-7F3K9QB2",    "kesAmount": "1281000.00",    "currency": "KES",    "payBefore": "2026-09-02T09:30:00.000Z",    "instructions": "M-PESA > Lipa na M-PESA > Pay Bill > Business number 444174 > Account number 46013001348902 > Amount 1281000.00. The Account number is what identifies you to us; M-PESA carries no narration, so keep the reference OL-7F3K9QB2 in your own records and quote it to us if you need to ask about this order."  },  "paymentReference": "OL-7F3K9QB2"}