Start a card checkout
curl --request POST \
--url https://api.calmtreasury.xyz/v1/card/checkout \
--header 'Content-Type: application/json' \
--header 'x-calm-publishable-key: <api-key>' \
--data '
{
"amount": "<string>",
"country": "<string>",
"payment_method": "<string>",
"wallet": "<string>",
"trade_type": "EXACT_INPUT"
}
'import requests
url = "https://api.calmtreasury.xyz/v1/card/checkout"
payload = {
"amount": "<string>",
"country": "<string>",
"payment_method": "<string>",
"wallet": "<string>",
"trade_type": "EXACT_INPUT"
}
headers = {
"x-calm-publishable-key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'x-calm-publishable-key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
amount: '<string>',
country: '<string>',
payment_method: '<string>',
wallet: '<string>',
trade_type: 'EXACT_INPUT'
})
};
fetch('https://api.calmtreasury.xyz/v1/card/checkout', 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.calmtreasury.xyz/v1/card/checkout",
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' => '<string>',
'country' => '<string>',
'payment_method' => '<string>',
'wallet' => '<string>',
'trade_type' => 'EXACT_INPUT'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"x-calm-publishable-key: <api-key>"
],
]);
$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.calmtreasury.xyz/v1/card/checkout"
payload := strings.NewReader("{\n \"amount\": \"<string>\",\n \"country\": \"<string>\",\n \"payment_method\": \"<string>\",\n \"wallet\": \"<string>\",\n \"trade_type\": \"EXACT_INPUT\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("x-calm-publishable-key", "<api-key>")
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.calmtreasury.xyz/v1/card/checkout")
.header("x-calm-publishable-key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"amount\": \"<string>\",\n \"country\": \"<string>\",\n \"payment_method\": \"<string>\",\n \"wallet\": \"<string>\",\n \"trade_type\": \"EXACT_INPUT\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.calmtreasury.xyz/v1/card/checkout")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["x-calm-publishable-key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"amount\": \"<string>\",\n \"country\": \"<string>\",\n \"payment_method\": \"<string>\",\n \"wallet\": \"<string>\",\n \"trade_type\": \"EXACT_INPUT\"\n}"
response = http.request(request)
puts response.read_body{
"order_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"url": "<string>"
}{
"error": {
"code": "<string>",
"message": "<string>"
}
}{
"error": {
"code": "<string>",
"message": "<string>"
}
}{
"error": {
"code": "<string>",
"message": "<string>"
}
}{
"error": {
"code": "<string>",
"message": "<string>"
}
}{
"error": {
"code": "<string>",
"message": "<string>"
}
}Card
Start a card checkout
Open a card purchase and return the hosted URL to render.
POST
/
v1
/
card
/
checkout
Start a card checkout
curl --request POST \
--url https://api.calmtreasury.xyz/v1/card/checkout \
--header 'Content-Type: application/json' \
--header 'x-calm-publishable-key: <api-key>' \
--data '
{
"amount": "<string>",
"country": "<string>",
"payment_method": "<string>",
"wallet": "<string>",
"trade_type": "EXACT_INPUT"
}
'import requests
url = "https://api.calmtreasury.xyz/v1/card/checkout"
payload = {
"amount": "<string>",
"country": "<string>",
"payment_method": "<string>",
"wallet": "<string>",
"trade_type": "EXACT_INPUT"
}
headers = {
"x-calm-publishable-key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'x-calm-publishable-key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
amount: '<string>',
country: '<string>',
payment_method: '<string>',
wallet: '<string>',
trade_type: 'EXACT_INPUT'
})
};
fetch('https://api.calmtreasury.xyz/v1/card/checkout', 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.calmtreasury.xyz/v1/card/checkout",
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' => '<string>',
'country' => '<string>',
'payment_method' => '<string>',
'wallet' => '<string>',
'trade_type' => 'EXACT_INPUT'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"x-calm-publishable-key: <api-key>"
],
]);
$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.calmtreasury.xyz/v1/card/checkout"
payload := strings.NewReader("{\n \"amount\": \"<string>\",\n \"country\": \"<string>\",\n \"payment_method\": \"<string>\",\n \"wallet\": \"<string>\",\n \"trade_type\": \"EXACT_INPUT\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("x-calm-publishable-key", "<api-key>")
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.calmtreasury.xyz/v1/card/checkout")
.header("x-calm-publishable-key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"amount\": \"<string>\",\n \"country\": \"<string>\",\n \"payment_method\": \"<string>\",\n \"wallet\": \"<string>\",\n \"trade_type\": \"EXACT_INPUT\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.calmtreasury.xyz/v1/card/checkout")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["x-calm-publishable-key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"amount\": \"<string>\",\n \"country\": \"<string>\",\n \"payment_method\": \"<string>\",\n \"wallet\": \"<string>\",\n \"trade_type\": \"EXACT_INPUT\"\n}"
response = http.request(request)
puts response.read_body{
"order_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"url": "<string>"
}{
"error": {
"code": "<string>",
"message": "<string>"
}
}{
"error": {
"code": "<string>",
"message": "<string>"
}
}{
"error": {
"code": "<string>",
"message": "<string>"
}
}{
"error": {
"code": "<string>",
"message": "<string>"
}
}{
"error": {
"code": "<string>",
"message": "<string>"
}
}Opens the purchase and returns both the hosted card URL to render and the
order to poll. Amount, currency, payment method and country are locked in
before the buyer sees the page, so it opens on the payment step. Poll
Get a card order for settlement.
Authorizations
Publishable key identifying the calling app.
Body
application/json
Pattern:
^\d{1,12}(\.\d{1,8})?$Pattern:
^[A-Z]{2}$Available options:
USD, GBP, EUR Available options:
1, 8453, 999, 1337, 4326, 143, 137, 42161 Available options:
USDC, USDm, AUSD, USDC.e Pattern:
^[a-z0-9-]{2,32}$Pattern:
^0x[a-fA-F0-9]{40}$Available options:
EXACT_INPUT, EXACT_OUTPUT