JustCryptoPay Developer Docs
API Reference
Accept USDT and USDC across five chains with a single REST API. Create a charge, redirect to hosted checkout or render your own screen, and receive a signed webhook the moment funds confirm on-chain. Every payment is non-custodial and settles straight to your wallet.
Base URL
https://justcryptopay.com
Supported networks
Each charge gets a unique deposit address on the chain you request. Stablecoins and chains currently accepted:
How a payment flows
- Create a charge with the fiat amount, chain and asset. You receive a unique address, the exact token amount expected, a QR and a hosted
pay_url. - Collect payment by redirecting the customer to
pay_url, or build your own screen from the charge fields. - Confirm once the deposit confirms on-chain. We send a signed webhook to your dashboard URL and the charge flips to confirmed.
Authentication
All API requests are authenticated with your merchant API key, sent in the X-API-Key header. Create and rotate keys from the dashboard. Keep keys server-side and never ship them in browser or mobile code.
X-API-Key: sk_live_your_merchant_api_key
401 unauthorized. Always call the API over HTTPS.Create a charge
Creates a payment request. Pass the fiat amount in USD plus the chain and asset you want to accept. We return a unique on-chain address and the exact token amount the customer must send.
Request body
| Field | Type | Required | Description |
|---|---|---|---|
amount_usd | string | Yes | Amount to collect in USD, as a decimal string. Example "29.99". |
chain | string | Yes | One of tron, polygon, bsc, base, solana. |
asset | string | Yes | USDT or USDC (Tron is USDT only). |
order_id | string | No | Your own reference. Echoed back and included in the webhook. |
metadata | object | No | Arbitrary key/value object stored with the charge. |
Example request
curl -X POST https://justcryptopay.com/v1/charges \
-H "X-API-Key: sk_live_your_merchant_api_key" \
-H "Content-Type: application/json" \
-d '{
"amount_usd": "29.99",
"chain": "tron",
"asset": "USDT",
"order_id": "ORD-10231",
"metadata": { "customer": "u_8842", "plan": "pro" }
}'
Example response 201 Created
{
"id": "chg_3Qa8Rn2kLpWv",
"status": "pending",
"amount_usd": "29.99",
"expected_amount": "29.990000",
"asset": "USDT",
"chain": "tron",
"network": "TRC-20",
"address": "TJmV5r8mKq2Yd9wN7sPcXbH4eLf6ZgApQe",
"order_id": "ORD-10231",
"pay_url": "https://justcryptopay.com/pay/chg_3Qa8Rn2kLpWv",
"expires_at": "2026-11-26T12:45:00Z",
"qr": "data:image/png;base64,iVBORw0KGgoAAAANSUhEUg..."
}
address is unique to this charge. Collect the exact expected_amount of the token. Under-payments stay pending until topped up or expired.Code snippets
// Node 18+ (global fetch)
const res = await fetch("https://justcryptopay.com/v1/charges", {
method: "POST",
headers: {
"X-API-Key": process.env.JCP_API_KEY,
"Content-Type": "application/json",
},
body: JSON.stringify({
amount_usd: "29.99",
chain: "tron",
asset: "USDT",
order_id: "ORD-10231",
metadata: { customer: "u_8842" },
}),
});
if (!res.ok) throw new Error(`JustCryptoPay ${res.status}`);
const charge = await res.json();
console.log(charge.pay_url, charge.address);
import os, requests
res = requests.post(
"https://justcryptopay.com/v1/charges",
headers={"X-API-Key": os.environ["JCP_API_KEY"]},
json={
"amount_usd": "29.99",
"chain": "tron",
"asset": "USDT",
"order_id": "ORD-10231",
"metadata": {"customer": "u_8842"},
},
timeout=20,
)
res.raise_for_status()
charge = res.json()
print(charge["pay_url"], charge["address"])
Fetch a charge
Retrieve the current state of a charge by its id. Uses the same X-API-Key auth. Useful for polling status or reconciling an order.
curl https://justcryptopay.com/v1/charges/chg_3Qa8Rn2kLpWv \
-H "X-API-Key: sk_live_your_merchant_api_key"
Get networks
Returns the chain/asset combinations your account can accept. Use it to render a payment-method picker without hard-coding the list.
curl https://justcryptopay.com/v1/networks \
-H "X-API-Key: sk_live_your_merchant_api_key"
Example response
{
"networks": [
{ "chain": "tron", "asset": "USDT", "label": "Tron (TRC-20)" },
{ "chain": "bsc", "asset": "USDT", "label": "BNB Smart Chain (BEP-20)" },
{ "chain": "bsc", "asset": "USDC", "label": "BNB Smart Chain (BEP-20)" },
{ "chain": "polygon", "asset": "USDT", "label": "Polygon" },
{ "chain": "polygon", "asset": "USDC", "label": "Polygon" },
{ "chain": "base", "asset": "USDT", "label": "Base" },
{ "chain": "base", "asset": "USDC", "label": "Base" },
{ "chain": "solana", "asset": "USDT", "label": "Solana" },
{ "chain": "solana", "asset": "USDC", "label": "Solana" }
]
}
Hosted checkout
The fastest integration: create a charge, then redirect the customer to the returned pay_url. The hosted page shows the deposit address, the exact amount, a scannable QR, a live countdown to expires_at, and the payment status as it updates, with no front-end work on your side.
// after creating the charge
res.redirect(charge.pay_url);
// -> https://justcryptopay.com/pay/chg_3Qa8Rn2kLpWv
address, expected_amount, qr (a ready-to-render data-URI image) and expires_at. Treat the webhook as your source of truth for "paid", not the browser returning.Webhooks / IPN
Set a webhook URL in your dashboard. When a charge confirms on-chain, we POST a JSON body to that URL with a signature header. This is the reliable, server-to-server signal that a payment succeeded.
Webhook payload
| Field | Type | Description |
|---|---|---|
event | string | Event name, e.g. charge.confirmed. |
id | string | The charge id. |
order_id | string | Your reference, if you supplied one. |
amount_usd | string | Requested USD amount. |
received_amount | string | Token amount actually received. |
fee_amount | string | Platform fee deducted (0.5% by default). |
net_amount | string | Amount settled to your wallet, after fee. |
asset / chain | string | Stablecoin and chain of the payment. |
tx_hash | string | On-chain transaction hash. |
status | string | Charge status, confirmed for a paid charge. |
Example webhook body
{
"event": "charge.confirmed",
"id": "chg_3Qa8Rn2kLpWv",
"order_id": "ORD-10231",
"amount_usd": "29.99",
"received_amount": "29.990000",
"fee_amount": "0.150000",
"net_amount": "29.840000",
"asset": "USDT",
"chain": "tron",
"tx_hash": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855",
"status": "confirmed"
}
2xx quickly. We retry non-2xx deliveries with backoff. Make your handler idempotent by keying on id or tx_hash, so a retried webhook never double-credits an order.Signature verification
Every webhook carries an X-JCP-Signature header: an HMAC-SHA256 of the raw request body computed with your webhook secret (found in the dashboard). Recompute it and compare using a constant-time check before trusting the payload.
X-JCP-Signature: 9f1c0b…e7a2 # hex HMAC-SHA256 of the raw body
import crypto from "crypto";
import express from "express";
const app = express();
const SECRET = process.env.JCP_WEBHOOK_SECRET;
// capture the RAW body, sign exactly what was received
app.post(
"/webhooks/justcryptopay",
express.raw({ type: "application/json" }),
(req, res) => {
const signature = req.get("X-JCP-Signature") || "";
const expected = crypto
.createHmac("sha256", SECRET)
.update(req.body) // req.body is a Buffer
.digest("hex");
const ok =
signature.length === expected.length &&
crypto.timingSafeEqual(
Buffer.from(signature),
Buffer.from(expected)
);
if (!ok) return res.status(400).send("invalid signature");
const event = JSON.parse(req.body.toString("utf8"));
if (event.event === "charge.confirmed") {
// fulfil order, idempotent on event.id
}
res.sendStatus(200);
}
);
import os, hmac, hashlib
from flask import Flask, request, abort
app = Flask(__name__)
SECRET = os.environ["JCP_WEBHOOK_SECRET"].encode()
@app.post("/webhooks/justcryptopay")
def justcryptopay_webhook():
raw = request.get_data() # raw bytes, sign exactly this
signature = request.headers.get("X-JCP-Signature", "")
expected = hmac.new(SECRET, raw, hashlib.sha256).hexdigest()
if not hmac.compare_digest(signature, expected):
abort(400, "invalid signature")
event = request.get_json()
if event["event"] == "charge.confirmed":
# fulfil order, idempotent on event["id"]
pass
return "", 200
Status values
A charge moves through a small set of states. Poll GET /v1/charges/{id} or rely on the webhook for the terminal state.
| Status | Meaning |
|---|---|
| pending | Charge created, waiting for the deposit to arrive and confirm. |
| confirming | Deposit seen on-chain, waiting for the required confirmations. |
| confirmed | Payment settled to your wallet. The webhook fires on this state. |
| expired | expires_at passed with no (or insufficient) payment. |
Errors
The API uses standard HTTP status codes. Error responses return a JSON body with a stable error code and a human-readable message.
{
"error": "invalid_request",
"message": "chain must be one of: tron, polygon, bsc, base, solana"
}
| HTTP | error | When |
|---|---|---|
400 | bad_request | Malformed JSON or missing body. |
401 | unauthorized | Missing or invalid X-API-Key. |
404 | not_found | No charge matches the given id. |
422 | invalid_request | A field failed validation (e.g. unsupported chain/asset pair). |
429 | rate_limited | Too many requests. Back off and retry. |
500 | server_error | Something went wrong on our side. Safe to retry idempotent reads. |