Convert Currency
curl --request GET \
--url https://api.stablepay.ai/fx/convert \
--header 'Authorization: Bearer <token>'import requests
url = "https://api.stablepay.ai/fx/convert"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://api.stablepay.ai/fx/convert', 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://api.stablepay.ai/fx/convert",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.stablepay.ai/fx/convert"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("Authorization", "Bearer <token>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://api.stablepay.ai/fx/convert")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.stablepay.ai/fx/convert")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body{
"convertedAmount": 123,
"exchangeRate": "<string>",
"expiryTimestamp": 123,
"payoutFee": "<string>"
}{
"error": 123,
"message": "<string>",
"details": {}
}{
"error": 123,
"message": "<string>",
"details": {}
}Stablepay Payment Endpoints
Get FX Rate
Convert between supported currencies using current exchange rates.
GET
/
fx
/
convert
Convert Currency
curl --request GET \
--url https://api.stablepay.ai/fx/convert \
--header 'Authorization: Bearer <token>'import requests
url = "https://api.stablepay.ai/fx/convert"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://api.stablepay.ai/fx/convert', 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://api.stablepay.ai/fx/convert",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.stablepay.ai/fx/convert"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("Authorization", "Bearer <token>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://api.stablepay.ai/fx/convert")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.stablepay.ai/fx/convert")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body{
"convertedAmount": 123,
"exchangeRate": "<string>",
"expiryTimestamp": 123,
"payoutFee": "<string>"
}{
"error": 123,
"message": "<string>",
"details": {}
}{
"error": 123,
"message": "<string>",
"details": {}
}Authorizations
API key authentication using Bearer scheme. Format: Bearer {STA_xxxx}
Query Parameters
Amount to convert
Required range:
x >= 0.01Source currency code
Available options:
ZAR, NGN, KES, GHS, UGX, TZS, ZMW, ETB Destination currency code
Available options:
USDC, USDT Response
Currency conversion successful
Total converted amount in the destination currency, inclusive of payout fee, payment network fee, and any applicable Optional Issuer Fee (OIF).
Market exchange rate sourced from local liquidity partners.
Timestamp (Unix timestamp) when the conversion amount expires
The payout fee comprises the mobile money or bank payout fee, payment network fee, and any applicable Optional Issuer Fee (OIF), and is included in the converted amount.