Create a payment or deposit
curl --request POST \
--url https://api.spacepay.solutions/v1/external/secretkey-auth/payments \
--header 'Content-Type: application/json' \
--header 'x-spacepay-secret-key: <api-key>' \
--data '
{
"currency": "USD",
"orderId": "Order_1234567890",
"type": "payment",
"amount": 400,
"customerRefId": "customer_42",
"redirectUrl": "https://merchant.example.com/checkout/success",
"customMetadata": "{\"cartId\":\"abc123\",\"promo\":\"SUMMER24\"}"
}
'import requests
url = "https://api.spacepay.solutions/v1/external/secretkey-auth/payments"
payload = {
"currency": "USD",
"orderId": "Order_1234567890",
"type": "payment",
"amount": 400,
"customerRefId": "customer_42",
"redirectUrl": "https://merchant.example.com/checkout/success",
"customMetadata": "{\"cartId\":\"abc123\",\"promo\":\"SUMMER24\"}"
}
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({
currency: 'USD',
orderId: 'Order_1234567890',
type: 'payment',
amount: 400,
customerRefId: 'customer_42',
redirectUrl: 'https://merchant.example.com/checkout/success',
customMetadata: '{"cartId":"abc123","promo":"SUMMER24"}'
})
};
fetch('https://api.spacepay.solutions/v1/external/secretkey-auth/payments', 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/payments",
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([
'currency' => 'USD',
'orderId' => 'Order_1234567890',
'type' => 'payment',
'amount' => 400,
'customerRefId' => 'customer_42',
'redirectUrl' => 'https://merchant.example.com/checkout/success',
'customMetadata' => '{"cartId":"abc123","promo":"SUMMER24"}'
]),
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/payments"
payload := strings.NewReader("{\n \"currency\": \"USD\",\n \"orderId\": \"Order_1234567890\",\n \"type\": \"payment\",\n \"amount\": 400,\n \"customerRefId\": \"customer_42\",\n \"redirectUrl\": \"https://merchant.example.com/checkout/success\",\n \"customMetadata\": \"{\\\"cartId\\\":\\\"abc123\\\",\\\"promo\\\":\\\"SUMMER24\\\"}\"\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/payments")
.header("x-spacepay-secret-key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"currency\": \"USD\",\n \"orderId\": \"Order_1234567890\",\n \"type\": \"payment\",\n \"amount\": 400,\n \"customerRefId\": \"customer_42\",\n \"redirectUrl\": \"https://merchant.example.com/checkout/success\",\n \"customMetadata\": \"{\\\"cartId\\\":\\\"abc123\\\",\\\"promo\\\":\\\"SUMMER24\\\"}\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.spacepay.solutions/v1/external/secretkey-auth/payments")
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 \"currency\": \"USD\",\n \"orderId\": \"Order_1234567890\",\n \"type\": \"payment\",\n \"amount\": 400,\n \"customerRefId\": \"customer_42\",\n \"redirectUrl\": \"https://merchant.example.com/checkout/success\",\n \"customMetadata\": \"{\\\"cartId\\\":\\\"abc123\\\",\\\"promo\\\":\\\"SUMMER24\\\"}\"\n}"
response = http.request(request)
puts response.read_body{
"paymentUrl": "https://spacepay.example.com/payment?paymentId=1234567890&secret=1234567890",
"secret": "1234567890",
"paymentId": "1234567890",
"payment": {
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"merchantId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"merchantShortName": "<string>",
"merchantLogoUrl": "<string>",
"type": "payment",
"amountInCents": 123,
"amountDueCents": 123,
"convenienceFeeCents": 123,
"merchantFeeCents": 123,
"swapFeeCents": 123,
"currency": "USD",
"status": "pending",
"quotes": [
{
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"paymentId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"token": {
"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
},
"chainId": "eip155:1",
"depositAddress": {
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"type": "EVM",
"address": "0xa0b86a33e6441b8c4c8c0c0c0c0c0c0c0c0c0c0",
"createdAt": "2023-11-07T05:31:56Z",
"paymentId": "<string>"
},
"expectedAmountAsset": "<string>",
"rateUsdAsset": 123,
"amountDueCents": 123,
"expiresAt": "2023-11-07T05:31:56Z",
"status": "active",
"createdAt": "2023-11-07T05:31:56Z"
}
],
"receipt": {
"paymentId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"selectedQuote": {
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"paymentId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"token": {
"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
},
"chainId": "eip155:1",
"depositAddress": {
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"type": "EVM",
"address": "0xa0b86a33e6441b8c4c8c0c0c0c0c0c0c0c0c0c0",
"createdAt": "2023-11-07T05:31:56Z",
"paymentId": "<string>"
},
"expectedAmountAsset": "<string>",
"rateUsdAsset": 123,
"amountDueCents": 123,
"expiresAt": "2023-11-07T05:31:56Z",
"status": "active",
"createdAt": "2023-11-07T05:31:56Z"
},
"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",
"txHash": "0xda3be87732110de6c1354c83770aae630ede9ac308d9f7b399ecfba23d923384",
"txBlockNumber": 123456,
"txTimestamp": "2021-01-01T00:00:00.000Z",
"txSenderAddress": "0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee",
"txGasUsed": 100000,
"txTotalCost": "1000000000000000000",
"txTotalCostUsdFractions": 1000000,
"txIsSponsored": true,
"processedBy": "webhook",
"txRiskScore": 85,
"txRiskSeverity": "LOW_RISK",
"txRiskProvider": "scorechain",
"createdAt": "2023-11-07T05:31:56Z"
},
"orderId": "<string>",
"redirectUrl": "<string>",
"createdAt": "2023-11-07T05:31:56Z",
"amountMerchantNetCents": 123
}
}Authorizations
Secret key for authentication of external API.
Body
The currency of the payment. Only USD is supported.
USD "USD"
The order ID from the merchant
255"Order_1234567890"
Type of the payment. "payment" requires a fixed amount; "deposit" accepts any amount sent by the customer.
payment, deposit Payment amount in cents (e.g., 100 = $1.00). Required for type "payment", ignored for type "deposit". Minimum: 400 cents, Maximum: 100000000 cents.
400 <= x <= 100000000400
Stable customer identifier for deposits: the same value reuses the same deposit wallet across a customer's deposits (scoped to the merchant). Ignored for checkout (PAYMENT-type) payments.
255"customer_42"
URL to redirect the customer to after successful payment
2048"https://merchant.example.com/checkout/success"
Arbitrary metadata to append to the redirect URL as a query string
2048"{\"cartId\":\"abc123\",\"promo\":\"SUMMER24\"}"
Response
Payment created successfully
URL of the payment screen where the customer can complete the payment
"https://spacepay.example.com/payment?paymentId=1234567890&secret=1234567890"
Secret of the payment
"1234567890"
Payment ID
"1234567890"
Payment
Show child attributes
Show child attributes
curl --request POST \
--url https://api.spacepay.solutions/v1/external/secretkey-auth/payments \
--header 'Content-Type: application/json' \
--header 'x-spacepay-secret-key: <api-key>' \
--data '
{
"currency": "USD",
"orderId": "Order_1234567890",
"type": "payment",
"amount": 400,
"customerRefId": "customer_42",
"redirectUrl": "https://merchant.example.com/checkout/success",
"customMetadata": "{\"cartId\":\"abc123\",\"promo\":\"SUMMER24\"}"
}
'import requests
url = "https://api.spacepay.solutions/v1/external/secretkey-auth/payments"
payload = {
"currency": "USD",
"orderId": "Order_1234567890",
"type": "payment",
"amount": 400,
"customerRefId": "customer_42",
"redirectUrl": "https://merchant.example.com/checkout/success",
"customMetadata": "{\"cartId\":\"abc123\",\"promo\":\"SUMMER24\"}"
}
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({
currency: 'USD',
orderId: 'Order_1234567890',
type: 'payment',
amount: 400,
customerRefId: 'customer_42',
redirectUrl: 'https://merchant.example.com/checkout/success',
customMetadata: '{"cartId":"abc123","promo":"SUMMER24"}'
})
};
fetch('https://api.spacepay.solutions/v1/external/secretkey-auth/payments', 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/payments",
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([
'currency' => 'USD',
'orderId' => 'Order_1234567890',
'type' => 'payment',
'amount' => 400,
'customerRefId' => 'customer_42',
'redirectUrl' => 'https://merchant.example.com/checkout/success',
'customMetadata' => '{"cartId":"abc123","promo":"SUMMER24"}'
]),
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/payments"
payload := strings.NewReader("{\n \"currency\": \"USD\",\n \"orderId\": \"Order_1234567890\",\n \"type\": \"payment\",\n \"amount\": 400,\n \"customerRefId\": \"customer_42\",\n \"redirectUrl\": \"https://merchant.example.com/checkout/success\",\n \"customMetadata\": \"{\\\"cartId\\\":\\\"abc123\\\",\\\"promo\\\":\\\"SUMMER24\\\"}\"\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/payments")
.header("x-spacepay-secret-key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"currency\": \"USD\",\n \"orderId\": \"Order_1234567890\",\n \"type\": \"payment\",\n \"amount\": 400,\n \"customerRefId\": \"customer_42\",\n \"redirectUrl\": \"https://merchant.example.com/checkout/success\",\n \"customMetadata\": \"{\\\"cartId\\\":\\\"abc123\\\",\\\"promo\\\":\\\"SUMMER24\\\"}\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.spacepay.solutions/v1/external/secretkey-auth/payments")
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 \"currency\": \"USD\",\n \"orderId\": \"Order_1234567890\",\n \"type\": \"payment\",\n \"amount\": 400,\n \"customerRefId\": \"customer_42\",\n \"redirectUrl\": \"https://merchant.example.com/checkout/success\",\n \"customMetadata\": \"{\\\"cartId\\\":\\\"abc123\\\",\\\"promo\\\":\\\"SUMMER24\\\"}\"\n}"
response = http.request(request)
puts response.read_body{
"paymentUrl": "https://spacepay.example.com/payment?paymentId=1234567890&secret=1234567890",
"secret": "1234567890",
"paymentId": "1234567890",
"payment": {
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"merchantId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"merchantShortName": "<string>",
"merchantLogoUrl": "<string>",
"type": "payment",
"amountInCents": 123,
"amountDueCents": 123,
"convenienceFeeCents": 123,
"merchantFeeCents": 123,
"swapFeeCents": 123,
"currency": "USD",
"status": "pending",
"quotes": [
{
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"paymentId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"token": {
"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
},
"chainId": "eip155:1",
"depositAddress": {
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"type": "EVM",
"address": "0xa0b86a33e6441b8c4c8c0c0c0c0c0c0c0c0c0c0",
"createdAt": "2023-11-07T05:31:56Z",
"paymentId": "<string>"
},
"expectedAmountAsset": "<string>",
"rateUsdAsset": 123,
"amountDueCents": 123,
"expiresAt": "2023-11-07T05:31:56Z",
"status": "active",
"createdAt": "2023-11-07T05:31:56Z"
}
],
"receipt": {
"paymentId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"selectedQuote": {
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"paymentId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"token": {
"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
},
"chainId": "eip155:1",
"depositAddress": {
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"type": "EVM",
"address": "0xa0b86a33e6441b8c4c8c0c0c0c0c0c0c0c0c0c0",
"createdAt": "2023-11-07T05:31:56Z",
"paymentId": "<string>"
},
"expectedAmountAsset": "<string>",
"rateUsdAsset": 123,
"amountDueCents": 123,
"expiresAt": "2023-11-07T05:31:56Z",
"status": "active",
"createdAt": "2023-11-07T05:31:56Z"
},
"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",
"txHash": "0xda3be87732110de6c1354c83770aae630ede9ac308d9f7b399ecfba23d923384",
"txBlockNumber": 123456,
"txTimestamp": "2021-01-01T00:00:00.000Z",
"txSenderAddress": "0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee",
"txGasUsed": 100000,
"txTotalCost": "1000000000000000000",
"txTotalCostUsdFractions": 1000000,
"txIsSponsored": true,
"processedBy": "webhook",
"txRiskScore": 85,
"txRiskSeverity": "LOW_RISK",
"txRiskProvider": "scorechain",
"createdAt": "2023-11-07T05:31:56Z"
},
"orderId": "<string>",
"redirectUrl": "<string>",
"createdAt": "2023-11-07T05:31:56Z",
"amountMerchantNetCents": 123
}
}