Get Crypto Bridge rate quote
curl --request POST \
--url https://sandbox-api.kotanipay.io/api/v3/rate/crypto-bridge \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"source_currency": "KES",
"source_amount": 1000,
"crypto_chain": "LIGHTNING",
"crypto_token": "MSAT",
"requested_crypto_amount": 150000000
}
'import requests
url = "https://sandbox-api.kotanipay.io/api/v3/rate/crypto-bridge"
payload = {
"source_currency": "KES",
"source_amount": 1000,
"crypto_chain": "LIGHTNING",
"crypto_token": "MSAT",
"requested_crypto_amount": 150000000
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
source_currency: 'KES',
source_amount: 1000,
crypto_chain: 'LIGHTNING',
crypto_token: 'MSAT',
requested_crypto_amount: 150000000
})
};
fetch('https://sandbox-api.kotanipay.io/api/v3/rate/crypto-bridge', 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-api.kotanipay.io/api/v3/rate/crypto-bridge",
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([
'source_currency' => 'KES',
'source_amount' => 1000,
'crypto_chain' => 'LIGHTNING',
'crypto_token' => 'MSAT',
'requested_crypto_amount' => 150000000
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$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-api.kotanipay.io/api/v3/rate/crypto-bridge"
payload := strings.NewReader("{\n \"source_currency\": \"KES\",\n \"source_amount\": 1000,\n \"crypto_chain\": \"LIGHTNING\",\n \"crypto_token\": \"MSAT\",\n \"requested_crypto_amount\": 150000000\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
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-api.kotanipay.io/api/v3/rate/crypto-bridge")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"source_currency\": \"KES\",\n \"source_amount\": 1000,\n \"crypto_chain\": \"LIGHTNING\",\n \"crypto_token\": \"MSAT\",\n \"requested_crypto_amount\": 150000000\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://sandbox-api.kotanipay.io/api/v3/rate/crypto-bridge")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"source_currency\": \"KES\",\n \"source_amount\": 1000,\n \"crypto_chain\": \"LIGHTNING\",\n \"crypto_token\": \"MSAT\",\n \"requested_crypto_amount\": 150000000\n}"
response = http.request(request)
puts response.read_body{
"success": true,
"message": "Crypto bridge rate quote generated successfully.",
"data": {
"rate_id": "RATE-CB-1732454321-XYZ123",
"source_amount": 1000,
"source_currency": "KES",
"crypto_amount": 150000000,
"crypto_unit": "msat",
"chain": "LIGHTNING",
"token": "MSAT",
"exchange_rate": {
"fiat_to_btc": "0.00000015",
"btc_to_msat": 100000000,
"exchange_rate_source": "COINBASE"
},
"fees": {
"fiat_fee": 15,
"fiat_fee_currency": "KES",
"crypto_fee": 1000,
"crypto_fee_unit": "sats",
"fee_percentage": 1.5
},
"total_cost": 1015,
"net_crypto_amount": 149000000,
"expires_at": "2024-11-24T12:01:00Z",
"created_at": "2024-11-24T12:00:00Z"
}
}{
"success": false,
"message": "Invalid request parameters",
"data": {}
}{
"success": false,
"message": "Invalid API Key",
"data": {}
}Exchange Rates
Get Crypto Bridge Rate
Get a rate quote for crypto bridge transactions (fiat to crypto conversion). This endpoint generates a rate_id that must be used in the crypto bridge deposit request. Rate is valid for 60 seconds and can only be used once. Currently supports: KES -> Lightning (MSAT)
POST
/
api
/
v3
/
rate
/
crypto-bridge
Get Crypto Bridge rate quote
curl --request POST \
--url https://sandbox-api.kotanipay.io/api/v3/rate/crypto-bridge \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"source_currency": "KES",
"source_amount": 1000,
"crypto_chain": "LIGHTNING",
"crypto_token": "MSAT",
"requested_crypto_amount": 150000000
}
'import requests
url = "https://sandbox-api.kotanipay.io/api/v3/rate/crypto-bridge"
payload = {
"source_currency": "KES",
"source_amount": 1000,
"crypto_chain": "LIGHTNING",
"crypto_token": "MSAT",
"requested_crypto_amount": 150000000
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
source_currency: 'KES',
source_amount: 1000,
crypto_chain: 'LIGHTNING',
crypto_token: 'MSAT',
requested_crypto_amount: 150000000
})
};
fetch('https://sandbox-api.kotanipay.io/api/v3/rate/crypto-bridge', 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-api.kotanipay.io/api/v3/rate/crypto-bridge",
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([
'source_currency' => 'KES',
'source_amount' => 1000,
'crypto_chain' => 'LIGHTNING',
'crypto_token' => 'MSAT',
'requested_crypto_amount' => 150000000
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$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-api.kotanipay.io/api/v3/rate/crypto-bridge"
payload := strings.NewReader("{\n \"source_currency\": \"KES\",\n \"source_amount\": 1000,\n \"crypto_chain\": \"LIGHTNING\",\n \"crypto_token\": \"MSAT\",\n \"requested_crypto_amount\": 150000000\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
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-api.kotanipay.io/api/v3/rate/crypto-bridge")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"source_currency\": \"KES\",\n \"source_amount\": 1000,\n \"crypto_chain\": \"LIGHTNING\",\n \"crypto_token\": \"MSAT\",\n \"requested_crypto_amount\": 150000000\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://sandbox-api.kotanipay.io/api/v3/rate/crypto-bridge")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"source_currency\": \"KES\",\n \"source_amount\": 1000,\n \"crypto_chain\": \"LIGHTNING\",\n \"crypto_token\": \"MSAT\",\n \"requested_crypto_amount\": 150000000\n}"
response = http.request(request)
puts response.read_body{
"success": true,
"message": "Crypto bridge rate quote generated successfully.",
"data": {
"rate_id": "RATE-CB-1732454321-XYZ123",
"source_amount": 1000,
"source_currency": "KES",
"crypto_amount": 150000000,
"crypto_unit": "msat",
"chain": "LIGHTNING",
"token": "MSAT",
"exchange_rate": {
"fiat_to_btc": "0.00000015",
"btc_to_msat": 100000000,
"exchange_rate_source": "COINBASE"
},
"fees": {
"fiat_fee": 15,
"fiat_fee_currency": "KES",
"crypto_fee": 1000,
"crypto_fee_unit": "sats",
"fee_percentage": 1.5
},
"total_cost": 1015,
"net_crypto_amount": 149000000,
"expires_at": "2024-11-24T12:01:00Z",
"created_at": "2024-11-24T12:00:00Z"
}
}{
"success": false,
"message": "Invalid request parameters",
"data": {}
}{
"success": false,
"message": "Invalid API Key",
"data": {}
}Get an exchange rate quote for a crypto bridge transaction before initiating the deposit. Use this to display the estimated source fiat amount, crypto amount, and destination fiat amount to the customer.
Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Body
application/json
Source fiat currency
Example:
"KES"
Source fiat amount customer will pay
Example:
1000
Blockchain/network to use
Available options:
CELO, ETHEREUM, ARBITRUM, AVALANCHE, BINANCE, POLYGON, OPTIMISM, FUSE, TRON, PROVENANCE, SOLANA, HEDERA, STELLAR, BASE, LISK, VICTION, SCROLL, LIGHTNING, CARDANO, ICP Example:
"LIGHTNING"
Crypto token to use
Available options:
CUSD, USDC, USDT, BUSD, HASH, HBAR, USDGLO, CKES, CGHS, MSAT, ADA, CKUSDT Example:
"MSAT"
Requested crypto amount (optional - for validation)
Example:
150000000