Request Refund
curl --request POST \
--url https://api.chessa.ai/v1/orders/refund \
--header 'Content-Type: application/json' \
--data '
{
"address": "bc1qxy2kgdygjrsqtzq2n0yrf2493p83kkfjhx0wlh",
"orderId": "order123",
"tag": "12345"
}
'import requests
url = "https://api.chessa.ai/v1/orders/refund"
payload = {
"address": "bc1qxy2kgdygjrsqtzq2n0yrf2493p83kkfjhx0wlh",
"orderId": "order123",
"tag": "12345"
}
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({
address: 'bc1qxy2kgdygjrsqtzq2n0yrf2493p83kkfjhx0wlh',
orderId: 'order123',
tag: '12345'
})
};
fetch('https://api.chessa.ai/v1/orders/refund', 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.chessa.ai/v1/orders/refund",
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([
'address' => 'bc1qxy2kgdygjrsqtzq2n0yrf2493p83kkfjhx0wlh',
'orderId' => 'order123',
'tag' => '12345'
]),
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.chessa.ai/v1/orders/refund"
payload := strings.NewReader("{\n \"address\": \"bc1qxy2kgdygjrsqtzq2n0yrf2493p83kkfjhx0wlh\",\n \"orderId\": \"order123\",\n \"tag\": \"12345\"\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.chessa.ai/v1/orders/refund")
.header("Content-Type", "application/json")
.body("{\n \"address\": \"bc1qxy2kgdygjrsqtzq2n0yrf2493p83kkfjhx0wlh\",\n \"orderId\": \"order123\",\n \"tag\": \"12345\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.chessa.ai/v1/orders/refund")
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 \"address\": \"bc1qxy2kgdygjrsqtzq2n0yrf2493p83kkfjhx0wlh\",\n \"orderId\": \"order123\",\n \"tag\": \"12345\"\n}"
response = http.request(request)
puts response.read_body{
"createdAt": "2025-03-18T10:45:22.123Z",
"cryptoAmount": "0.05",
"cryptoAsset": "BTC",
"estimatedCompletionTime": "2025-03-18T12:45:22.123Z",
"orderId": "ord_abcdef123456789",
"reason": "Customer requested cancellation",
"refundAddress": "bc1qxy2kgdygjrsqtzq2n0yrf2493p83kkfjhx0wlh",
"refundId": "ref_123456789abcdef",
"status": "pending",
"updatedAt": "2025-03-18T10:45:22.123Z"
}{
"error": "invalid_refund_request",
"message": "Cannot refund an order that is already completed or refunded",
"statusCode": 400
}{
"error": "not_found",
"message": "Order not found",
"statusCode": 404
}Orders
Request Refund
Request a refund for an order.
POST
/
v1
/
orders
/
refund
Request Refund
curl --request POST \
--url https://api.chessa.ai/v1/orders/refund \
--header 'Content-Type: application/json' \
--data '
{
"address": "bc1qxy2kgdygjrsqtzq2n0yrf2493p83kkfjhx0wlh",
"orderId": "order123",
"tag": "12345"
}
'import requests
url = "https://api.chessa.ai/v1/orders/refund"
payload = {
"address": "bc1qxy2kgdygjrsqtzq2n0yrf2493p83kkfjhx0wlh",
"orderId": "order123",
"tag": "12345"
}
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({
address: 'bc1qxy2kgdygjrsqtzq2n0yrf2493p83kkfjhx0wlh',
orderId: 'order123',
tag: '12345'
})
};
fetch('https://api.chessa.ai/v1/orders/refund', 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.chessa.ai/v1/orders/refund",
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([
'address' => 'bc1qxy2kgdygjrsqtzq2n0yrf2493p83kkfjhx0wlh',
'orderId' => 'order123',
'tag' => '12345'
]),
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.chessa.ai/v1/orders/refund"
payload := strings.NewReader("{\n \"address\": \"bc1qxy2kgdygjrsqtzq2n0yrf2493p83kkfjhx0wlh\",\n \"orderId\": \"order123\",\n \"tag\": \"12345\"\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.chessa.ai/v1/orders/refund")
.header("Content-Type", "application/json")
.body("{\n \"address\": \"bc1qxy2kgdygjrsqtzq2n0yrf2493p83kkfjhx0wlh\",\n \"orderId\": \"order123\",\n \"tag\": \"12345\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.chessa.ai/v1/orders/refund")
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 \"address\": \"bc1qxy2kgdygjrsqtzq2n0yrf2493p83kkfjhx0wlh\",\n \"orderId\": \"order123\",\n \"tag\": \"12345\"\n}"
response = http.request(request)
puts response.read_body{
"createdAt": "2025-03-18T10:45:22.123Z",
"cryptoAmount": "0.05",
"cryptoAsset": "BTC",
"estimatedCompletionTime": "2025-03-18T12:45:22.123Z",
"orderId": "ord_abcdef123456789",
"reason": "Customer requested cancellation",
"refundAddress": "bc1qxy2kgdygjrsqtzq2n0yrf2493p83kkfjhx0wlh",
"refundId": "ref_123456789abcdef",
"status": "pending",
"updatedAt": "2025-03-18T10:45:22.123Z"
}{
"error": "invalid_refund_request",
"message": "Cannot refund an order that is already completed or refunded",
"statusCode": 400
}{
"error": "not_found",
"message": "Order not found",
"statusCode": 404
}Body
application/json
Response
Success Response
Example:
"2025-03-18T10:45:22.123Z"
Example:
"0.05"
Example:
"BTC"
Example:
"2025-03-18T12:45:22.123Z"
Example:
"ord_abcdef123456789"
Example:
"Customer requested cancellation"
Example:
"bc1qxy2kgdygjrsqtzq2n0yrf2493p83kkfjhx0wlh"
Example:
"ref_123456789abcdef"
Example:
"pending"
Example:
"2025-03-18T10:45:22.123Z"
Was this page helpful?