Offramp Request
curl --request POST \
--url https://preview.kotanipay.com/api/v3/offramp \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"cryptoAmount": 123,
"referenceId": "<string>",
"senderAddress": "<string>",
"callbackUrl": "<string>",
"rateId": "<string>",
"refundInitiated": true,
"refundStatus": "<string>",
"refundTransactionHash": "<string>",
"refundAmount": 123
}
'import requests
url = "https://preview.kotanipay.com/api/v3/offramp"
payload = {
"cryptoAmount": 123,
"referenceId": "<string>",
"senderAddress": "<string>",
"callbackUrl": "<string>",
"rateId": "<string>",
"refundInitiated": True,
"refundStatus": "<string>",
"refundTransactionHash": "<string>",
"refundAmount": 123
}
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({
cryptoAmount: 123,
referenceId: '<string>',
senderAddress: '<string>',
callbackUrl: '<string>',
rateId: '<string>',
refundInitiated: true,
refundStatus: '<string>',
refundTransactionHash: '<string>',
refundAmount: 123
})
};
fetch('https://preview.kotanipay.com/api/v3/offramp', 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://preview.kotanipay.com/api/v3/offramp",
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([
'cryptoAmount' => 123,
'referenceId' => '<string>',
'senderAddress' => '<string>',
'callbackUrl' => '<string>',
'rateId' => '<string>',
'refundInitiated' => true,
'refundStatus' => '<string>',
'refundTransactionHash' => '<string>',
'refundAmount' => 123
]),
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://preview.kotanipay.com/api/v3/offramp"
payload := strings.NewReader("{\n \"cryptoAmount\": 123,\n \"referenceId\": \"<string>\",\n \"senderAddress\": \"<string>\",\n \"callbackUrl\": \"<string>\",\n \"rateId\": \"<string>\",\n \"refundInitiated\": true,\n \"refundStatus\": \"<string>\",\n \"refundTransactionHash\": \"<string>\",\n \"refundAmount\": 123\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://preview.kotanipay.com/api/v3/offramp")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"cryptoAmount\": 123,\n \"referenceId\": \"<string>\",\n \"senderAddress\": \"<string>\",\n \"callbackUrl\": \"<string>\",\n \"rateId\": \"<string>\",\n \"refundInitiated\": true,\n \"refundStatus\": \"<string>\",\n \"refundTransactionHash\": \"<string>\",\n \"refundAmount\": 123\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://preview.kotanipay.com/api/v3/offramp")
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 \"cryptoAmount\": 123,\n \"referenceId\": \"<string>\",\n \"senderAddress\": \"<string>\",\n \"callbackUrl\": \"<string>\",\n \"rateId\": \"<string>\",\n \"refundInitiated\": true,\n \"refundStatus\": \"<string>\",\n \"refundTransactionHash\": \"<string>\",\n \"refundAmount\": 123\n}"
response = http.request(request)
puts response.read_body{
"success": true,
"message": "Offramp has been successfully created",
"data": {
"referenceId": "<string>",
"fiatAmount": 123,
"fiatTransactionAmount": 123,
"cryptoAmount": 123,
"fiatCurrency": "KES",
"customerKey": "<string>",
"fiatWalletId": "<string>",
"senderAddress": "<string>",
"transactionHash": "<string>",
"transactionHashAmount": 123,
"status": "<string>",
"onchainStatus": "<string>",
"rate": {},
"escrowAddress": "<string>",
"usingIntegratedWallet": true,
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z",
"onchainError": {},
"transactionError": {}
}
}{
"success": false,
"message": "Bad Request",
"data": {}
}{
"success": false,
"message": "Unauthorized",
"data": {}
}Offramp (Sell Crypto)
Create Offramp Request
This endpoint will create a offramp request for a customer. If the fiat transfer fails after successful crypto receipt, an automatic refund will be initiated after 5 minutes. Use the refund-status endpoint to check refund status.
POST
/
api
/
v3
/
offramp
Offramp Request
curl --request POST \
--url https://preview.kotanipay.com/api/v3/offramp \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"cryptoAmount": 123,
"referenceId": "<string>",
"senderAddress": "<string>",
"callbackUrl": "<string>",
"rateId": "<string>",
"refundInitiated": true,
"refundStatus": "<string>",
"refundTransactionHash": "<string>",
"refundAmount": 123
}
'import requests
url = "https://preview.kotanipay.com/api/v3/offramp"
payload = {
"cryptoAmount": 123,
"referenceId": "<string>",
"senderAddress": "<string>",
"callbackUrl": "<string>",
"rateId": "<string>",
"refundInitiated": True,
"refundStatus": "<string>",
"refundTransactionHash": "<string>",
"refundAmount": 123
}
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({
cryptoAmount: 123,
referenceId: '<string>',
senderAddress: '<string>',
callbackUrl: '<string>',
rateId: '<string>',
refundInitiated: true,
refundStatus: '<string>',
refundTransactionHash: '<string>',
refundAmount: 123
})
};
fetch('https://preview.kotanipay.com/api/v3/offramp', 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://preview.kotanipay.com/api/v3/offramp",
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([
'cryptoAmount' => 123,
'referenceId' => '<string>',
'senderAddress' => '<string>',
'callbackUrl' => '<string>',
'rateId' => '<string>',
'refundInitiated' => true,
'refundStatus' => '<string>',
'refundTransactionHash' => '<string>',
'refundAmount' => 123
]),
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://preview.kotanipay.com/api/v3/offramp"
payload := strings.NewReader("{\n \"cryptoAmount\": 123,\n \"referenceId\": \"<string>\",\n \"senderAddress\": \"<string>\",\n \"callbackUrl\": \"<string>\",\n \"rateId\": \"<string>\",\n \"refundInitiated\": true,\n \"refundStatus\": \"<string>\",\n \"refundTransactionHash\": \"<string>\",\n \"refundAmount\": 123\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://preview.kotanipay.com/api/v3/offramp")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"cryptoAmount\": 123,\n \"referenceId\": \"<string>\",\n \"senderAddress\": \"<string>\",\n \"callbackUrl\": \"<string>\",\n \"rateId\": \"<string>\",\n \"refundInitiated\": true,\n \"refundStatus\": \"<string>\",\n \"refundTransactionHash\": \"<string>\",\n \"refundAmount\": 123\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://preview.kotanipay.com/api/v3/offramp")
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 \"cryptoAmount\": 123,\n \"referenceId\": \"<string>\",\n \"senderAddress\": \"<string>\",\n \"callbackUrl\": \"<string>\",\n \"rateId\": \"<string>\",\n \"refundInitiated\": true,\n \"refundStatus\": \"<string>\",\n \"refundTransactionHash\": \"<string>\",\n \"refundAmount\": 123\n}"
response = http.request(request)
puts response.read_body{
"success": true,
"message": "Offramp has been successfully created",
"data": {
"referenceId": "<string>",
"fiatAmount": 123,
"fiatTransactionAmount": 123,
"cryptoAmount": 123,
"fiatCurrency": "KES",
"customerKey": "<string>",
"fiatWalletId": "<string>",
"senderAddress": "<string>",
"transactionHash": "<string>",
"transactionHashAmount": 123,
"status": "<string>",
"onchainStatus": "<string>",
"rate": {},
"escrowAddress": "<string>",
"usingIntegratedWallet": true,
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z",
"onchainError": {},
"transactionError": {}
}
}{
"success": false,
"message": "Bad Request",
"data": {}
}{
"success": false,
"message": "Unauthorized",
"data": {}
}This endpoint will create an offramp request for a customer to convert crypto to fiat.
Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Body
application/json
The crypto amount
Fiat currency
Available options:
KES, GHS, TZS, UGX, ZMW, XAF, XOF, CDF, RWF, ETB, ZAR Chain
Available options:
ETHEREUM, CELO, AVALANCHE, POLYGON, ARBITRUM, OPTIMISM, STELLAR, TRON, FUSE, LIGHTNING, SOLANA, PROVENANCE, CARDANO, HEDERA, BASE, LISK, VICTION, SCROLL Stable Coin or Token
Available options:
CUSD, USDC, USDT, USDT0, SAT, BTC, HASH, FUSE, HBAR, USDGLO, CKES, CGHS, MSAT, XLM, ADA Reference ID
Mobile Money receiver details
Show child attributes
Show child attributes
Bank receiver details
Show child attributes
Show child attributes
Sender address (optional - if not provided, will use integrator crypto wallet)
Callback Url
Rate ID
Whether refund has been initiated
Refund status
Refund transaction hash
Refund amount