Make a swap
curl --request POST \
--url https://api.example.com/exchange/swap \
--header 'Content-Type: application/json' \
--data '
{
"amount": 1000,
"quote_id": "570745f5-1252-417f-badf-8b6f19d2319e",
"reference": "6b35c97f-99e3-4310-af92-2bb0404cfa5a",
"source_currency": "USD",
"target_currency": "NGN"
}
'import requests
url = "https://api.example.com/exchange/swap"
payload = {
"amount": 1000,
"quote_id": "570745f5-1252-417f-badf-8b6f19d2319e",
"reference": "6b35c97f-99e3-4310-af92-2bb0404cfa5a",
"source_currency": "USD",
"target_currency": "NGN"
}
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({
amount: 1000,
quote_id: '570745f5-1252-417f-badf-8b6f19d2319e',
reference: '6b35c97f-99e3-4310-af92-2bb0404cfa5a',
source_currency: 'USD',
target_currency: 'NGN'
})
};
fetch('https://api.example.com/exchange/swap', 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.example.com/exchange/swap",
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([
'amount' => 1000,
'quote_id' => '570745f5-1252-417f-badf-8b6f19d2319e',
'reference' => '6b35c97f-99e3-4310-af92-2bb0404cfa5a',
'source_currency' => 'USD',
'target_currency' => 'NGN'
]),
CURLOPT_HTTPHEADER => [
"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://api.example.com/exchange/swap"
payload := strings.NewReader("{\n \"amount\": 1000,\n \"quote_id\": \"570745f5-1252-417f-badf-8b6f19d2319e\",\n \"reference\": \"6b35c97f-99e3-4310-af92-2bb0404cfa5a\",\n \"source_currency\": \"USD\",\n \"target_currency\": \"NGN\"\n}")
req, _ := http.NewRequest("POST", url, payload)
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://api.example.com/exchange/swap")
.header("Content-Type", "application/json")
.body("{\n \"amount\": 1000,\n \"quote_id\": \"570745f5-1252-417f-badf-8b6f19d2319e\",\n \"reference\": \"6b35c97f-99e3-4310-af92-2bb0404cfa5a\",\n \"source_currency\": \"USD\",\n \"target_currency\": \"NGN\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/exchange/swap")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"amount\": 1000,\n \"quote_id\": \"570745f5-1252-417f-badf-8b6f19d2319e\",\n \"reference\": \"6b35c97f-99e3-4310-af92-2bb0404cfa5a\",\n \"source_currency\": \"USD\",\n \"target_currency\": \"NGN\"\n}"
response = http.request(request)
puts response.read_body{
"data": {
"correlation_id": "7da742ea-a1bc-11ee-b907-560f156a658b",
"created_at": "2021-01-01T00:00:00Z",
"customer": {
"email": "customer@email.com",
"id": "1",
"name": "User 1",
"type": "user"
},
"id": "7da8e726-a1bc-11ee-80cf-560f156a658b",
"provider": {
"email": "provider@email.com",
"id": "1",
"name": "Provider 1",
"type": "provider"
},
"source_amount": {
"amount": 1,
"currency": "USD"
},
"status": "success",
"symbol": "USD-NGN",
"target_amount": {
"amount": 1000,
"currency": "NGN"
},
"updated_at": "2021-01-01T00:00:00Z"
}
}exchange
Make a swap
POST
/
exchange
/
swap
Make a swap
curl --request POST \
--url https://api.example.com/exchange/swap \
--header 'Content-Type: application/json' \
--data '
{
"amount": 1000,
"quote_id": "570745f5-1252-417f-badf-8b6f19d2319e",
"reference": "6b35c97f-99e3-4310-af92-2bb0404cfa5a",
"source_currency": "USD",
"target_currency": "NGN"
}
'import requests
url = "https://api.example.com/exchange/swap"
payload = {
"amount": 1000,
"quote_id": "570745f5-1252-417f-badf-8b6f19d2319e",
"reference": "6b35c97f-99e3-4310-af92-2bb0404cfa5a",
"source_currency": "USD",
"target_currency": "NGN"
}
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({
amount: 1000,
quote_id: '570745f5-1252-417f-badf-8b6f19d2319e',
reference: '6b35c97f-99e3-4310-af92-2bb0404cfa5a',
source_currency: 'USD',
target_currency: 'NGN'
})
};
fetch('https://api.example.com/exchange/swap', 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.example.com/exchange/swap",
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([
'amount' => 1000,
'quote_id' => '570745f5-1252-417f-badf-8b6f19d2319e',
'reference' => '6b35c97f-99e3-4310-af92-2bb0404cfa5a',
'source_currency' => 'USD',
'target_currency' => 'NGN'
]),
CURLOPT_HTTPHEADER => [
"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://api.example.com/exchange/swap"
payload := strings.NewReader("{\n \"amount\": 1000,\n \"quote_id\": \"570745f5-1252-417f-badf-8b6f19d2319e\",\n \"reference\": \"6b35c97f-99e3-4310-af92-2bb0404cfa5a\",\n \"source_currency\": \"USD\",\n \"target_currency\": \"NGN\"\n}")
req, _ := http.NewRequest("POST", url, payload)
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://api.example.com/exchange/swap")
.header("Content-Type", "application/json")
.body("{\n \"amount\": 1000,\n \"quote_id\": \"570745f5-1252-417f-badf-8b6f19d2319e\",\n \"reference\": \"6b35c97f-99e3-4310-af92-2bb0404cfa5a\",\n \"source_currency\": \"USD\",\n \"target_currency\": \"NGN\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/exchange/swap")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"amount\": 1000,\n \"quote_id\": \"570745f5-1252-417f-badf-8b6f19d2319e\",\n \"reference\": \"6b35c97f-99e3-4310-af92-2bb0404cfa5a\",\n \"source_currency\": \"USD\",\n \"target_currency\": \"NGN\"\n}"
response = http.request(request)
puts response.read_body{
"data": {
"correlation_id": "7da742ea-a1bc-11ee-b907-560f156a658b",
"created_at": "2021-01-01T00:00:00Z",
"customer": {
"email": "customer@email.com",
"id": "1",
"name": "User 1",
"type": "user"
},
"id": "7da8e726-a1bc-11ee-80cf-560f156a658b",
"provider": {
"email": "provider@email.com",
"id": "1",
"name": "Provider 1",
"type": "provider"
},
"source_amount": {
"amount": 1,
"currency": "USD"
},
"status": "success",
"symbol": "USD-NGN",
"target_amount": {
"amount": 1000,
"currency": "NGN"
},
"updated_at": "2021-01-01T00:00:00Z"
}
}Body
application/json
Swap params
Response
Swap Details
Response schema for swap
Swap details
Show child attributes
Show child attributes
Example:
{
"correlation_id": "7da742ea-a1bc-11ee-b907-560f156a658b",
"created_at": "2021-01-01T00:00:00Z",
"customer": {
"email": "customer@email.com",
"id": "1",
"name": "User 1",
"type": "user"
},
"id": "7da8e726-a1bc-11ee-80cf-560f156a658b",
"provider": {
"email": "provider@email.com",
"id": "1",
"name": "Provider 1",
"type": "provider"
},
"source_amount": { "amount": 1, "currency": "USD" },
"status": "success",
"symbol": "USD-NGN",
"target_amount": { "amount": 1000, "currency": "NGN" },
"updated_at": "2021-01-01T00:00:00Z"
}
⌘I