Create order from plaintext payload
curl --request POST \
--url https://sandbox.elementpay.net/orders/create \
--header 'Content-Type: application/json' \
--header 'X-API-Key: <api-key>' \
--data '
{
"user_address": "<string>",
"token": "<string>",
"fiat_payload": {
"amount_fiat": 123,
"phone_number": "<string>",
"till_number": "<string>",
"paybill_number": "<string>",
"account_number": "<string>",
"bank_code": "<string>",
"reference": "<string>",
"currency": "KES",
"narrative": "<string>",
"client_ref": "<string>",
"metadata": {}
}
}
'import requests
url = "https://sandbox.elementpay.net/orders/create"
payload = {
"user_address": "<string>",
"token": "<string>",
"fiat_payload": {
"amount_fiat": 123,
"phone_number": "<string>",
"till_number": "<string>",
"paybill_number": "<string>",
"account_number": "<string>",
"bank_code": "<string>",
"reference": "<string>",
"currency": "KES",
"narrative": "<string>",
"client_ref": "<string>",
"metadata": {}
}
}
headers = {
"X-API-Key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'X-API-Key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
user_address: '<string>',
token: '<string>',
fiat_payload: {
amount_fiat: 123,
phone_number: '<string>',
till_number: '<string>',
paybill_number: '<string>',
account_number: '<string>',
bank_code: '<string>',
reference: '<string>',
currency: 'KES',
narrative: '<string>',
client_ref: '<string>',
metadata: {}
}
})
};
fetch('https://sandbox.elementpay.net/orders/create', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://sandbox.elementpay.net/orders/create",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'user_address' => '<string>',
'token' => '<string>',
'fiat_payload' => [
'amount_fiat' => 123,
'phone_number' => '<string>',
'till_number' => '<string>',
'paybill_number' => '<string>',
'account_number' => '<string>',
'bank_code' => '<string>',
'reference' => '<string>',
'currency' => 'KES',
'narrative' => '<string>',
'client_ref' => '<string>',
'metadata' => [
]
]
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"X-API-Key: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://sandbox.elementpay.net/orders/create"
payload := strings.NewReader("{\n \"user_address\": \"<string>\",\n \"token\": \"<string>\",\n \"fiat_payload\": {\n \"amount_fiat\": 123,\n \"phone_number\": \"<string>\",\n \"till_number\": \"<string>\",\n \"paybill_number\": \"<string>\",\n \"account_number\": \"<string>\",\n \"bank_code\": \"<string>\",\n \"reference\": \"<string>\",\n \"currency\": \"KES\",\n \"narrative\": \"<string>\",\n \"client_ref\": \"<string>\",\n \"metadata\": {}\n }\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("X-API-Key", "<api-key>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://sandbox.elementpay.net/orders/create")
.header("X-API-Key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"user_address\": \"<string>\",\n \"token\": \"<string>\",\n \"fiat_payload\": {\n \"amount_fiat\": 123,\n \"phone_number\": \"<string>\",\n \"till_number\": \"<string>\",\n \"paybill_number\": \"<string>\",\n \"account_number\": \"<string>\",\n \"bank_code\": \"<string>\",\n \"reference\": \"<string>\",\n \"currency\": \"KES\",\n \"narrative\": \"<string>\",\n \"client_ref\": \"<string>\",\n \"metadata\": {}\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://sandbox.elementpay.net/orders/create")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["X-API-Key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"user_address\": \"<string>\",\n \"token\": \"<string>\",\n \"fiat_payload\": {\n \"amount_fiat\": 123,\n \"phone_number\": \"<string>\",\n \"till_number\": \"<string>\",\n \"paybill_number\": \"<string>\",\n \"account_number\": \"<string>\",\n \"bank_code\": \"<string>\",\n \"reference\": \"<string>\",\n \"currency\": \"KES\",\n \"narrative\": \"<string>\",\n \"client_ref\": \"<string>\",\n \"metadata\": {}\n }\n}"
response = http.request(request)
puts response.read_body{
"status": "success",
"message": "Order submitted",
"data": {
"tx_hash": "0xabc123...",
"status": "submitted",
"rate_used": 142.1234,
"amount_sent": 12.34,
"fiat_paid": 1750
}
}Order Endpoints
Create order
Accepts plaintext payload, applies markup to KES rate, hashes message, and submits order.
POST
/
orders
/
create
Create order from plaintext payload
curl --request POST \
--url https://sandbox.elementpay.net/orders/create \
--header 'Content-Type: application/json' \
--header 'X-API-Key: <api-key>' \
--data '
{
"user_address": "<string>",
"token": "<string>",
"fiat_payload": {
"amount_fiat": 123,
"phone_number": "<string>",
"till_number": "<string>",
"paybill_number": "<string>",
"account_number": "<string>",
"bank_code": "<string>",
"reference": "<string>",
"currency": "KES",
"narrative": "<string>",
"client_ref": "<string>",
"metadata": {}
}
}
'import requests
url = "https://sandbox.elementpay.net/orders/create"
payload = {
"user_address": "<string>",
"token": "<string>",
"fiat_payload": {
"amount_fiat": 123,
"phone_number": "<string>",
"till_number": "<string>",
"paybill_number": "<string>",
"account_number": "<string>",
"bank_code": "<string>",
"reference": "<string>",
"currency": "KES",
"narrative": "<string>",
"client_ref": "<string>",
"metadata": {}
}
}
headers = {
"X-API-Key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'X-API-Key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
user_address: '<string>',
token: '<string>',
fiat_payload: {
amount_fiat: 123,
phone_number: '<string>',
till_number: '<string>',
paybill_number: '<string>',
account_number: '<string>',
bank_code: '<string>',
reference: '<string>',
currency: 'KES',
narrative: '<string>',
client_ref: '<string>',
metadata: {}
}
})
};
fetch('https://sandbox.elementpay.net/orders/create', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://sandbox.elementpay.net/orders/create",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'user_address' => '<string>',
'token' => '<string>',
'fiat_payload' => [
'amount_fiat' => 123,
'phone_number' => '<string>',
'till_number' => '<string>',
'paybill_number' => '<string>',
'account_number' => '<string>',
'bank_code' => '<string>',
'reference' => '<string>',
'currency' => 'KES',
'narrative' => '<string>',
'client_ref' => '<string>',
'metadata' => [
]
]
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"X-API-Key: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://sandbox.elementpay.net/orders/create"
payload := strings.NewReader("{\n \"user_address\": \"<string>\",\n \"token\": \"<string>\",\n \"fiat_payload\": {\n \"amount_fiat\": 123,\n \"phone_number\": \"<string>\",\n \"till_number\": \"<string>\",\n \"paybill_number\": \"<string>\",\n \"account_number\": \"<string>\",\n \"bank_code\": \"<string>\",\n \"reference\": \"<string>\",\n \"currency\": \"KES\",\n \"narrative\": \"<string>\",\n \"client_ref\": \"<string>\",\n \"metadata\": {}\n }\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("X-API-Key", "<api-key>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://sandbox.elementpay.net/orders/create")
.header("X-API-Key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"user_address\": \"<string>\",\n \"token\": \"<string>\",\n \"fiat_payload\": {\n \"amount_fiat\": 123,\n \"phone_number\": \"<string>\",\n \"till_number\": \"<string>\",\n \"paybill_number\": \"<string>\",\n \"account_number\": \"<string>\",\n \"bank_code\": \"<string>\",\n \"reference\": \"<string>\",\n \"currency\": \"KES\",\n \"narrative\": \"<string>\",\n \"client_ref\": \"<string>\",\n \"metadata\": {}\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://sandbox.elementpay.net/orders/create")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["X-API-Key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"user_address\": \"<string>\",\n \"token\": \"<string>\",\n \"fiat_payload\": {\n \"amount_fiat\": 123,\n \"phone_number\": \"<string>\",\n \"till_number\": \"<string>\",\n \"paybill_number\": \"<string>\",\n \"account_number\": \"<string>\",\n \"bank_code\": \"<string>\",\n \"reference\": \"<string>\",\n \"currency\": \"KES\",\n \"narrative\": \"<string>\",\n \"client_ref\": \"<string>\",\n \"metadata\": {}\n }\n}"
response = http.request(request)
puts response.read_body{
"status": "success",
"message": "Order submitted",
"data": {
"tx_hash": "0xabc123...",
"status": "submitted",
"rate_used": 142.1234,
"amount_sent": 12.34,
"fiat_paid": 1750
}
}Create a new on-ramp or off-ramp order.
What happens
Success
Error shapes (examples)
400 insufficient allowance:
401 missing/invalid key:
Track the order
- Validates request and locks the quote as
rate_used. - For OFFRAMP, the service submits the on-chain tx for you (no gas from client).
- Returns the creation transaction hash
tx_hashimmediately.
{ "status": "success|error", "message": "string", "data": { ... } }
data fields
tx_hash— creation transaction hash (use withGET /orders/tx/{tx_hash}).status— order state:submitted | processing | settled | failed | refunded.rate_used— FX rate applied when the quote was locked.amount_sent— token amount in 6 decimals units (e.g.,0.71234USDC).fiat_paid— fiat amount charged/expected.
{
"status": "success",
"message": "Order submitted",
"data": {
"tx_hash": "0xabc123...",
"status": "submitted",
"rate_used": 142.1234,
"amount_sent": 12.34,
"fiat_paid": 1750
}
}
{ "status": "error", "message": "Approve the contract to spend your tokens before OffRamp.", "data": { "required": 79218430, "current": 0 } }
{ "status": "error", "message": "Missing API key", "data": null }
GET /orders/tx/{tx_hash}— fetch current status and details.- Webhooks — configure a webhook URL + secret on your API key to receive async updates.
X-API-Key: <key> with every request.Authorizations
Body
application/json
Create order request body.
Customer EVM address. For ONRAMP: receives the tokens. For OFFRAMP: spender address (must have ERC-20 allowance for the contract). If allowance is insufficient, the API returns 400 insufficient_allowance with data.required and data.current.
ERC-20 token contract address (checksummed). Use /meta/tokens to discover supported tokens and addresses.
Order direction. Integer enum (0=ONRAMP, 1=OFFRAMP).
Available options:
0, 1 Fiat configuration (amount, destination type, and destination details).
Show child attributes
Show child attributes
Response
Order submitted
⌘I

