Withdrawals (alpha)
Create a withdrawal
POST
/
v1
/
external
/
secretkey-auth
/
withdrawals
Create a withdrawal
curl --request POST \
--url https://api.spacepay.solutions/v1/external/secretkey-auth/withdrawals \
--header 'Content-Type: application/json' \
--header 'x-spacepay-secret-key: <api-key>' \
--data '
{
"amountInCents": 100,
"chainId": "eip155:8453",
"recipientAddress": "<string>",
"orderId": "Order_1234567890",
"customMetadata": "{\"cartId\":\"abc123\",\"promo\":\"SUMMER24\"}",
"currency": "USD"
}
'import requests
url = "https://api.spacepay.solutions/v1/external/secretkey-auth/withdrawals"
payload = {
"amountInCents": 100,
"chainId": "eip155:8453",
"recipientAddress": "<string>",
"orderId": "Order_1234567890",
"customMetadata": "{\"cartId\":\"abc123\",\"promo\":\"SUMMER24\"}",
"currency": "USD"
}
headers = {
"x-spacepay-secret-key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'x-spacepay-secret-key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
amountInCents: 100,
chainId: 'eip155:8453',
recipientAddress: '<string>',
orderId: 'Order_1234567890',
customMetadata: '{"cartId":"abc123","promo":"SUMMER24"}',
currency: 'USD'
})
};
fetch('https://api.spacepay.solutions/v1/external/secretkey-auth/withdrawals', 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.spacepay.solutions/v1/external/secretkey-auth/withdrawals",
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([
'amountInCents' => 100,
'chainId' => 'eip155:8453',
'recipientAddress' => '<string>',
'orderId' => 'Order_1234567890',
'customMetadata' => '{"cartId":"abc123","promo":"SUMMER24"}',
'currency' => 'USD'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"x-spacepay-secret-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.spacepay.solutions/v1/external/secretkey-auth/withdrawals"
payload := strings.NewReader("{\n \"amountInCents\": 100,\n \"chainId\": \"eip155:8453\",\n \"recipientAddress\": \"<string>\",\n \"orderId\": \"Order_1234567890\",\n \"customMetadata\": \"{\\\"cartId\\\":\\\"abc123\\\",\\\"promo\\\":\\\"SUMMER24\\\"}\",\n \"currency\": \"USD\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("x-spacepay-secret-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.spacepay.solutions/v1/external/secretkey-auth/withdrawals")
.header("x-spacepay-secret-key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"amountInCents\": 100,\n \"chainId\": \"eip155:8453\",\n \"recipientAddress\": \"<string>\",\n \"orderId\": \"Order_1234567890\",\n \"customMetadata\": \"{\\\"cartId\\\":\\\"abc123\\\",\\\"promo\\\":\\\"SUMMER24\\\"}\",\n \"currency\": \"USD\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.spacepay.solutions/v1/external/secretkey-auth/withdrawals")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["x-spacepay-secret-key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"amountInCents\": 100,\n \"chainId\": \"eip155:8453\",\n \"recipientAddress\": \"<string>\",\n \"orderId\": \"Order_1234567890\",\n \"customMetadata\": \"{\\\"cartId\\\":\\\"abc123\\\",\\\"promo\\\":\\\"SUMMER24\\\"}\",\n \"currency\": \"USD\"\n}"
response = http.request(request)
puts response.read_body{
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"merchantId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"amountInCents": 123,
"chainId": "eip155:8453",
"recipientAddress": "<string>",
"status": "pending",
"currency": "USD",
"orderId": "<string>",
"customMetadata": "<string>",
"errorMessage": "<string>",
"receipt": {
"withdrawalId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"settledToken": {
"id": "123e4567-e89b-12d3-a456-426614174000",
"coingeckoApiId": "ethereum",
"chain": {
"chainId": "eip155:1",
"name": "Ethereum",
"nativeSymbol": "ETH",
"nativeDecimals": 18,
"isEnabled": true,
"isTestnet": false
},
"symbol": "USDC",
"contractAddress": "0xa0b86a33e6441b8c4c8c0c0c0c0c0c0c0c0c0c0",
"decimals": 6,
"type": "stablecoin",
"assetType": "native",
"status": "active",
"tokenPriceUsd": 1
},
"settledChain": {
"chainId": "eip155:1",
"name": "Ethereum",
"nativeSymbol": "ETH",
"nativeDecimals": 18,
"isEnabled": true,
"isTestnet": false
},
"settledAmountAsset": "100",
"settledAmountUsd": "100.00",
"txBlockNumber": 123456,
"txTimestamp": "2021-01-01T00:00:00.000Z",
"txSenderAddress": "0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee",
"txGasUsed": 100000,
"txTotalCost": "1000000000000000000",
"txTotalCostUsdFractions": 1000000,
"txIsSponsored": true,
"processedBy": "webhook",
"createdAt": "2023-11-07T05:31:56Z",
"txHash": "0xda3be87732110de6c1354c83770aae630ede9ac308d9f7b399ecfba23d923384"
},
"createdAt": "2023-11-07T05:31:56Z",
"updatedAt": "2023-11-07T05:31:56Z"
}Authorizations
Secret key for authentication of external API.
Body
application/json
Withdrawal amount in cents (e.g., 100 = $1.00). Minimum: 100 cents, Maximum: 100000000 cents.
Required range:
100 <= x <= 100000000Example:
100
CAIP-2 chain id (EVM)
Maximum string length:
41Example:
"eip155:8453"
Beneficiary address
Order ID from the merchant
Maximum string length:
255Example:
"Order_1234567890"
Arbitrary metadata to attach to the withdrawal
Maximum string length:
2048Example:
"{\"cartId\":\"abc123\",\"promo\":\"SUMMER24\"}"
Currency of the withdrawal (defaults to USD)
Available options:
USD Response
Withdrawal created successfully
Withdrawal ID
Merchant ID
Withdrawal amount in USD cents
CAIP-2 chain id
Example:
"eip155:8453"
Beneficiary address
Withdrawal status
Available options:
pending, processing, completed, failed, cancelled Currency of the withdrawal
Available options:
USD Optional order ID
Optional custom metadata
Error message (if failed)
Withdrawal receipt
Show child attributes
Show child attributes
Created at
Updated at
⌘I
Create a withdrawal
curl --request POST \
--url https://api.spacepay.solutions/v1/external/secretkey-auth/withdrawals \
--header 'Content-Type: application/json' \
--header 'x-spacepay-secret-key: <api-key>' \
--data '
{
"amountInCents": 100,
"chainId": "eip155:8453",
"recipientAddress": "<string>",
"orderId": "Order_1234567890",
"customMetadata": "{\"cartId\":\"abc123\",\"promo\":\"SUMMER24\"}",
"currency": "USD"
}
'import requests
url = "https://api.spacepay.solutions/v1/external/secretkey-auth/withdrawals"
payload = {
"amountInCents": 100,
"chainId": "eip155:8453",
"recipientAddress": "<string>",
"orderId": "Order_1234567890",
"customMetadata": "{\"cartId\":\"abc123\",\"promo\":\"SUMMER24\"}",
"currency": "USD"
}
headers = {
"x-spacepay-secret-key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'x-spacepay-secret-key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
amountInCents: 100,
chainId: 'eip155:8453',
recipientAddress: '<string>',
orderId: 'Order_1234567890',
customMetadata: '{"cartId":"abc123","promo":"SUMMER24"}',
currency: 'USD'
})
};
fetch('https://api.spacepay.solutions/v1/external/secretkey-auth/withdrawals', 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.spacepay.solutions/v1/external/secretkey-auth/withdrawals",
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([
'amountInCents' => 100,
'chainId' => 'eip155:8453',
'recipientAddress' => '<string>',
'orderId' => 'Order_1234567890',
'customMetadata' => '{"cartId":"abc123","promo":"SUMMER24"}',
'currency' => 'USD'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"x-spacepay-secret-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.spacepay.solutions/v1/external/secretkey-auth/withdrawals"
payload := strings.NewReader("{\n \"amountInCents\": 100,\n \"chainId\": \"eip155:8453\",\n \"recipientAddress\": \"<string>\",\n \"orderId\": \"Order_1234567890\",\n \"customMetadata\": \"{\\\"cartId\\\":\\\"abc123\\\",\\\"promo\\\":\\\"SUMMER24\\\"}\",\n \"currency\": \"USD\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("x-spacepay-secret-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.spacepay.solutions/v1/external/secretkey-auth/withdrawals")
.header("x-spacepay-secret-key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"amountInCents\": 100,\n \"chainId\": \"eip155:8453\",\n \"recipientAddress\": \"<string>\",\n \"orderId\": \"Order_1234567890\",\n \"customMetadata\": \"{\\\"cartId\\\":\\\"abc123\\\",\\\"promo\\\":\\\"SUMMER24\\\"}\",\n \"currency\": \"USD\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.spacepay.solutions/v1/external/secretkey-auth/withdrawals")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["x-spacepay-secret-key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"amountInCents\": 100,\n \"chainId\": \"eip155:8453\",\n \"recipientAddress\": \"<string>\",\n \"orderId\": \"Order_1234567890\",\n \"customMetadata\": \"{\\\"cartId\\\":\\\"abc123\\\",\\\"promo\\\":\\\"SUMMER24\\\"}\",\n \"currency\": \"USD\"\n}"
response = http.request(request)
puts response.read_body{
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"merchantId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"amountInCents": 123,
"chainId": "eip155:8453",
"recipientAddress": "<string>",
"status": "pending",
"currency": "USD",
"orderId": "<string>",
"customMetadata": "<string>",
"errorMessage": "<string>",
"receipt": {
"withdrawalId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"settledToken": {
"id": "123e4567-e89b-12d3-a456-426614174000",
"coingeckoApiId": "ethereum",
"chain": {
"chainId": "eip155:1",
"name": "Ethereum",
"nativeSymbol": "ETH",
"nativeDecimals": 18,
"isEnabled": true,
"isTestnet": false
},
"symbol": "USDC",
"contractAddress": "0xa0b86a33e6441b8c4c8c0c0c0c0c0c0c0c0c0c0",
"decimals": 6,
"type": "stablecoin",
"assetType": "native",
"status": "active",
"tokenPriceUsd": 1
},
"settledChain": {
"chainId": "eip155:1",
"name": "Ethereum",
"nativeSymbol": "ETH",
"nativeDecimals": 18,
"isEnabled": true,
"isTestnet": false
},
"settledAmountAsset": "100",
"settledAmountUsd": "100.00",
"txBlockNumber": 123456,
"txTimestamp": "2021-01-01T00:00:00.000Z",
"txSenderAddress": "0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee",
"txGasUsed": 100000,
"txTotalCost": "1000000000000000000",
"txTotalCostUsdFractions": 1000000,
"txIsSponsored": true,
"processedBy": "webhook",
"createdAt": "2023-11-07T05:31:56Z",
"txHash": "0xda3be87732110de6c1354c83770aae630ede9ac308d9f7b399ecfba23d923384"
},
"createdAt": "2023-11-07T05:31:56Z",
"updatedAt": "2023-11-07T05:31:56Z"
}