curl --request POST \
--url https://api.beta.suby.fi/v3/crypto/charges \
--header 'Content-Type: application/json' \
--header 'X-Suby-Api-Key: <api-key>' \
--data '
{
"chainId": 8453,
"asset": "USDC",
"customer": {
"id": "cus_abc123",
"email": "jsmith@example.com",
"firstName": "<string>",
"lastName": "<string>"
},
"productId": "pro_abc123",
"priceCents": "1999",
"currency": "<string>",
"displayName": "<string>",
"displayDescription": "<string>",
"displayImageUrl": "<string>",
"payerAddress": "<string>",
"externalRef": "<string>",
"metadata": {}
}
'import requests
url = "https://api.beta.suby.fi/v3/crypto/charges"
payload = {
"chainId": 8453,
"asset": "USDC",
"customer": {
"id": "cus_abc123",
"email": "jsmith@example.com",
"firstName": "<string>",
"lastName": "<string>"
},
"productId": "pro_abc123",
"priceCents": "1999",
"currency": "<string>",
"displayName": "<string>",
"displayDescription": "<string>",
"displayImageUrl": "<string>",
"payerAddress": "<string>",
"externalRef": "<string>",
"metadata": {}
}
headers = {
"X-Suby-Api-Key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'X-Suby-Api-Key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
chainId: 8453,
asset: 'USDC',
customer: {
id: 'cus_abc123',
email: 'jsmith@example.com',
firstName: '<string>',
lastName: '<string>'
},
productId: 'pro_abc123',
priceCents: '1999',
currency: '<string>',
displayName: '<string>',
displayDescription: '<string>',
displayImageUrl: '<string>',
payerAddress: '<string>',
externalRef: '<string>',
metadata: {}
})
};
fetch('https://api.beta.suby.fi/v3/crypto/charges', 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.beta.suby.fi/v3/crypto/charges",
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([
'chainId' => 8453,
'asset' => 'USDC',
'customer' => [
'id' => 'cus_abc123',
'email' => 'jsmith@example.com',
'firstName' => '<string>',
'lastName' => '<string>'
],
'productId' => 'pro_abc123',
'priceCents' => '1999',
'currency' => '<string>',
'displayName' => '<string>',
'displayDescription' => '<string>',
'displayImageUrl' => '<string>',
'payerAddress' => '<string>',
'externalRef' => '<string>',
'metadata' => [
]
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"X-Suby-Api-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.beta.suby.fi/v3/crypto/charges"
payload := strings.NewReader("{\n \"chainId\": 8453,\n \"asset\": \"USDC\",\n \"customer\": {\n \"id\": \"cus_abc123\",\n \"email\": \"jsmith@example.com\",\n \"firstName\": \"<string>\",\n \"lastName\": \"<string>\"\n },\n \"productId\": \"pro_abc123\",\n \"priceCents\": \"1999\",\n \"currency\": \"<string>\",\n \"displayName\": \"<string>\",\n \"displayDescription\": \"<string>\",\n \"displayImageUrl\": \"<string>\",\n \"payerAddress\": \"<string>\",\n \"externalRef\": \"<string>\",\n \"metadata\": {}\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("X-Suby-Api-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.beta.suby.fi/v3/crypto/charges")
.header("X-Suby-Api-Key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"chainId\": 8453,\n \"asset\": \"USDC\",\n \"customer\": {\n \"id\": \"cus_abc123\",\n \"email\": \"jsmith@example.com\",\n \"firstName\": \"<string>\",\n \"lastName\": \"<string>\"\n },\n \"productId\": \"pro_abc123\",\n \"priceCents\": \"1999\",\n \"currency\": \"<string>\",\n \"displayName\": \"<string>\",\n \"displayDescription\": \"<string>\",\n \"displayImageUrl\": \"<string>\",\n \"payerAddress\": \"<string>\",\n \"externalRef\": \"<string>\",\n \"metadata\": {}\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.beta.suby.fi/v3/crypto/charges")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["X-Suby-Api-Key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"chainId\": 8453,\n \"asset\": \"USDC\",\n \"customer\": {\n \"id\": \"cus_abc123\",\n \"email\": \"jsmith@example.com\",\n \"firstName\": \"<string>\",\n \"lastName\": \"<string>\"\n },\n \"productId\": \"pro_abc123\",\n \"priceCents\": \"1999\",\n \"currency\": \"<string>\",\n \"displayName\": \"<string>\",\n \"displayDescription\": \"<string>\",\n \"displayImageUrl\": \"<string>\",\n \"payerAddress\": \"<string>\",\n \"externalRef\": \"<string>\",\n \"metadata\": {}\n}"
response = http.request(request)
puts response.read_body{
"success": true,
"data": {
"payment": {
"rail": "card",
"id": "pay_abc123",
"organizationId": "<string>",
"customerId": "<string>",
"productId": "<string>",
"subscriptionId": "<string>",
"status": "PENDING",
"paymentMethodCategory": "CARD",
"declineCode": "<string>",
"declineCategory": "SOFT",
"declineAdvice": "TRY_AGAIN_LATER",
"declineNetworkCode": "<string>",
"threeDSecureResult": "AUTHENTICATED",
"displayName": "<string>",
"displayDescription": "<string>",
"displayImageUrl": "<string>",
"priceCents": "<string>",
"currency": "<string>",
"tokenAmount": "<string>",
"tokenFeeAmount": "<string>",
"quoteFiatAmountCents": 123,
"quoteFiatCurrency": "<string>",
"grossAmountCents": 123,
"platformFeeCents": 123,
"merchantNetCents": 123,
"vatAmountCents": 123,
"vatRateBps": 123,
"taxInclusive": true,
"fxSurchargeCents": 123,
"internationalCardSurchargeCents": 123,
"rollingReserveCents": 123,
"refundedAmountCents": 123,
"refundedAt": "2023-11-07T05:31:56Z",
"cryptoSettlementMode": "<string>",
"settlementChainId": 123,
"settlementAsset": "<string>",
"settlementRecipient": "<string>",
"depositAddress": "<string>",
"settlementTxHash": "<string>",
"lifiTxHash": "<string>",
"lifiSubstatus": "<string>",
"successUrl": "<string>",
"cancelUrl": "<string>",
"externalRef": "<string>",
"paymentReceivedAt": "2023-11-07T05:31:56Z",
"paymentSettledAt": "2023-11-07T05:31:56Z",
"paymentConfirmedAt": "2023-11-07T05:31:56Z",
"createdAt": "2023-11-07T05:31:56Z",
"updatedAt": "2023-11-07T05:31:56Z",
"expiresAt": "2023-11-07T05:31:56Z",
"statusTimeline": [
{
"status": "PENDING",
"at": "2023-11-07T05:31:56Z"
}
],
"items": [
{
"productId": "<string>",
"name": "<string>",
"quantity": 123,
"unitPriceCents": 123
}
],
"asset": {
"chainId": 123,
"chainName": "<string>",
"chainLogoUrl": "<string>",
"symbol": "<string>",
"decimals": 123,
"address": "<string>",
"logoUrl": "<string>"
},
"settlementChain": {
"chainId": 123,
"name": "<string>",
"logoUrl": "<string>"
},
"deposit": {
"expected": "<string>",
"received": "<string>",
"remaining": "<string>",
"confirmations": {
"observed": 123,
"required": 123,
"detectedAt": "2023-11-07T05:31:56Z"
},
"warnings": [
{
"code": "INSUFFICIENT_DEPOSIT_AMOUNT",
"message": "<string>",
"data": {}
}
]
}
},
"instruction": {
"kind": "qr_deposit",
"chainId": 123,
"depositAddress": "<string>",
"expectedAmount": "<string>",
"decimals": 123,
"symbol": "<string>",
"address": "<string>",
"bip21Uri": "<string>",
"surchargeNote": "<string>"
}
},
"message": "<string>"
}{
"success": false,
"error": "UNAUTHORIZED",
"message": "Invalid or missing API key"
}{
"success": false,
"error": "NOT_FOUND",
"message": "Resource not found"
}{
"success": false,
"error": "NOT_FOUND",
"message": "Resource not found",
"data": "<unknown>"
}Create a crypto charge
The headless rail · render the flow inside your own site, no PCI scope.
Returns the charge plus the instruction that completes it · qr_deposit an
address and the exact amount (BIP21 URI on Bitcoin), wallet_connect calldata to
sign (ABI-encoded on EVM, base64 transaction on Solana).
Poll GET /v3/payments/{id} · its deposit envelope carries expected /
received / remaining and a confirmations counter.
Settlement routing is an account setting, not a field here. One consequence: an
account converging to a stablecoin on another chain takes qr_deposit only ·
wallet_connect answers CRYPTO_AUTOSWAP_MODE_NOT_SUPPORTED.
curl --request POST \
--url https://api.beta.suby.fi/v3/crypto/charges \
--header 'Content-Type: application/json' \
--header 'X-Suby-Api-Key: <api-key>' \
--data '
{
"chainId": 8453,
"asset": "USDC",
"customer": {
"id": "cus_abc123",
"email": "jsmith@example.com",
"firstName": "<string>",
"lastName": "<string>"
},
"productId": "pro_abc123",
"priceCents": "1999",
"currency": "<string>",
"displayName": "<string>",
"displayDescription": "<string>",
"displayImageUrl": "<string>",
"payerAddress": "<string>",
"externalRef": "<string>",
"metadata": {}
}
'import requests
url = "https://api.beta.suby.fi/v3/crypto/charges"
payload = {
"chainId": 8453,
"asset": "USDC",
"customer": {
"id": "cus_abc123",
"email": "jsmith@example.com",
"firstName": "<string>",
"lastName": "<string>"
},
"productId": "pro_abc123",
"priceCents": "1999",
"currency": "<string>",
"displayName": "<string>",
"displayDescription": "<string>",
"displayImageUrl": "<string>",
"payerAddress": "<string>",
"externalRef": "<string>",
"metadata": {}
}
headers = {
"X-Suby-Api-Key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'X-Suby-Api-Key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
chainId: 8453,
asset: 'USDC',
customer: {
id: 'cus_abc123',
email: 'jsmith@example.com',
firstName: '<string>',
lastName: '<string>'
},
productId: 'pro_abc123',
priceCents: '1999',
currency: '<string>',
displayName: '<string>',
displayDescription: '<string>',
displayImageUrl: '<string>',
payerAddress: '<string>',
externalRef: '<string>',
metadata: {}
})
};
fetch('https://api.beta.suby.fi/v3/crypto/charges', 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.beta.suby.fi/v3/crypto/charges",
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([
'chainId' => 8453,
'asset' => 'USDC',
'customer' => [
'id' => 'cus_abc123',
'email' => 'jsmith@example.com',
'firstName' => '<string>',
'lastName' => '<string>'
],
'productId' => 'pro_abc123',
'priceCents' => '1999',
'currency' => '<string>',
'displayName' => '<string>',
'displayDescription' => '<string>',
'displayImageUrl' => '<string>',
'payerAddress' => '<string>',
'externalRef' => '<string>',
'metadata' => [
]
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"X-Suby-Api-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.beta.suby.fi/v3/crypto/charges"
payload := strings.NewReader("{\n \"chainId\": 8453,\n \"asset\": \"USDC\",\n \"customer\": {\n \"id\": \"cus_abc123\",\n \"email\": \"jsmith@example.com\",\n \"firstName\": \"<string>\",\n \"lastName\": \"<string>\"\n },\n \"productId\": \"pro_abc123\",\n \"priceCents\": \"1999\",\n \"currency\": \"<string>\",\n \"displayName\": \"<string>\",\n \"displayDescription\": \"<string>\",\n \"displayImageUrl\": \"<string>\",\n \"payerAddress\": \"<string>\",\n \"externalRef\": \"<string>\",\n \"metadata\": {}\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("X-Suby-Api-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.beta.suby.fi/v3/crypto/charges")
.header("X-Suby-Api-Key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"chainId\": 8453,\n \"asset\": \"USDC\",\n \"customer\": {\n \"id\": \"cus_abc123\",\n \"email\": \"jsmith@example.com\",\n \"firstName\": \"<string>\",\n \"lastName\": \"<string>\"\n },\n \"productId\": \"pro_abc123\",\n \"priceCents\": \"1999\",\n \"currency\": \"<string>\",\n \"displayName\": \"<string>\",\n \"displayDescription\": \"<string>\",\n \"displayImageUrl\": \"<string>\",\n \"payerAddress\": \"<string>\",\n \"externalRef\": \"<string>\",\n \"metadata\": {}\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.beta.suby.fi/v3/crypto/charges")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["X-Suby-Api-Key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"chainId\": 8453,\n \"asset\": \"USDC\",\n \"customer\": {\n \"id\": \"cus_abc123\",\n \"email\": \"jsmith@example.com\",\n \"firstName\": \"<string>\",\n \"lastName\": \"<string>\"\n },\n \"productId\": \"pro_abc123\",\n \"priceCents\": \"1999\",\n \"currency\": \"<string>\",\n \"displayName\": \"<string>\",\n \"displayDescription\": \"<string>\",\n \"displayImageUrl\": \"<string>\",\n \"payerAddress\": \"<string>\",\n \"externalRef\": \"<string>\",\n \"metadata\": {}\n}"
response = http.request(request)
puts response.read_body{
"success": true,
"data": {
"payment": {
"rail": "card",
"id": "pay_abc123",
"organizationId": "<string>",
"customerId": "<string>",
"productId": "<string>",
"subscriptionId": "<string>",
"status": "PENDING",
"paymentMethodCategory": "CARD",
"declineCode": "<string>",
"declineCategory": "SOFT",
"declineAdvice": "TRY_AGAIN_LATER",
"declineNetworkCode": "<string>",
"threeDSecureResult": "AUTHENTICATED",
"displayName": "<string>",
"displayDescription": "<string>",
"displayImageUrl": "<string>",
"priceCents": "<string>",
"currency": "<string>",
"tokenAmount": "<string>",
"tokenFeeAmount": "<string>",
"quoteFiatAmountCents": 123,
"quoteFiatCurrency": "<string>",
"grossAmountCents": 123,
"platformFeeCents": 123,
"merchantNetCents": 123,
"vatAmountCents": 123,
"vatRateBps": 123,
"taxInclusive": true,
"fxSurchargeCents": 123,
"internationalCardSurchargeCents": 123,
"rollingReserveCents": 123,
"refundedAmountCents": 123,
"refundedAt": "2023-11-07T05:31:56Z",
"cryptoSettlementMode": "<string>",
"settlementChainId": 123,
"settlementAsset": "<string>",
"settlementRecipient": "<string>",
"depositAddress": "<string>",
"settlementTxHash": "<string>",
"lifiTxHash": "<string>",
"lifiSubstatus": "<string>",
"successUrl": "<string>",
"cancelUrl": "<string>",
"externalRef": "<string>",
"paymentReceivedAt": "2023-11-07T05:31:56Z",
"paymentSettledAt": "2023-11-07T05:31:56Z",
"paymentConfirmedAt": "2023-11-07T05:31:56Z",
"createdAt": "2023-11-07T05:31:56Z",
"updatedAt": "2023-11-07T05:31:56Z",
"expiresAt": "2023-11-07T05:31:56Z",
"statusTimeline": [
{
"status": "PENDING",
"at": "2023-11-07T05:31:56Z"
}
],
"items": [
{
"productId": "<string>",
"name": "<string>",
"quantity": 123,
"unitPriceCents": 123
}
],
"asset": {
"chainId": 123,
"chainName": "<string>",
"chainLogoUrl": "<string>",
"symbol": "<string>",
"decimals": 123,
"address": "<string>",
"logoUrl": "<string>"
},
"settlementChain": {
"chainId": 123,
"name": "<string>",
"logoUrl": "<string>"
},
"deposit": {
"expected": "<string>",
"received": "<string>",
"remaining": "<string>",
"confirmations": {
"observed": 123,
"required": 123,
"detectedAt": "2023-11-07T05:31:56Z"
},
"warnings": [
{
"code": "INSUFFICIENT_DEPOSIT_AMOUNT",
"message": "<string>",
"data": {}
}
]
}
},
"instruction": {
"kind": "qr_deposit",
"chainId": 123,
"depositAddress": "<string>",
"expectedAmount": "<string>",
"decimals": 123,
"symbol": "<string>",
"address": "<string>",
"bip21Uri": "<string>",
"surchargeNote": "<string>"
}
},
"message": "<string>"
}{
"success": false,
"error": "UNAUTHORIZED",
"message": "Invalid or missing API key"
}{
"success": false,
"error": "NOT_FOUND",
"message": "Resource not found"
}{
"success": false,
"error": "NOT_FOUND",
"message": "Resource not found",
"data": "<unknown>"
}Authorizations
Secret API key. sk_live_… (production) or sk_sandbox_… (sandbox).
Headers
Optional key (≤255 chars, e.g. a UUID v4) making this POST safe to retry · the response is cached 24h and a retry with the SAME key replays it instead of re-executing. The same key with a different body → 422 IDEMPOTENCY_KEY_CONFLICT; a retry while the first is in flight → 409.
255"5f3b9c2e-1a4d-4f2b-9c31-7e2a1b6d8c04"
Body
Pricing · productId (its price snapshot) OR priceCents + currency + a displayName. A customer is always required: the deposit address is HD-derived from one.
qr_deposit returns an address the payer sends to; wallet_connect returns calldata their wallet signs.
qr_deposit, wallet_connect From GET /v3/crypto/assets.
8453
The token's ticker on that chain, case-insensitive · (chainId, asset) is the public key.
2 - 12"USDC"
How a customer is named in a request body: exactly one of id or email. With id the name fields are ignored · the customer already has them on file. With email the customer is created on the fly (email is the get-or-create key). Supplying both, or neither, is a validation error.
Show child attributes
Show child attributes
"pro_abc123"
Minor units as a string of digits. Requires currency. A card charge under 1.00 (VAT included) is refused with CARD_PAYMENT_BELOW_MIN.
^[1-9]\\d*$"1999"
^[A-Z]{3}$Receipt label. Defaults to the product name · REQUIRED when the charge names no productId, which leaves nothing else to label it with.
200500wallet_connect only · the connected wallet (Solana fee payer, EVM sender). Omit to charge the customer's HD-derived address.
120Key-value pairs. ≤50 keys, keys ≤40 chars, values are
strings ≤500 chars (or null to clear). Nested structures must be
JSON-stringified into a single string value.
Show child attributes
Show child attributes
Was this page helpful?

