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, then a second event once they settle to your wallet. Payments are non-custodial by design.
Base URL
https://justcryptopay.io
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
charge.confirmedwebhook and the charge flips to confirmed — the payer is done. - Settle is a separate step for managed acceptance: the funds are swept to your wallet and a
charge.settledwebhook fires with the settlement tx hash and timestamp. Settlement can be pending, held, failed or complete.
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.io/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.io/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.io/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.io/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.io/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.io/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.io/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.Embed on your site
Take payments without ever sending the customer to our domain. Drop in one script and open the checkout in a modal that stays on your page. Include the widget once:
<script src="https://justcryptopay.io/embed.js"></script>
Option A — Pre-created charge (most secure)
Create the charge on your backend with your secret key (POST /v1/charges), then open it by id. The amount is fixed server-side, so it cannot be tampered with in the browser.
JustCryptoPay.open({
charge: 'CHARGE_ID_FROM_YOUR_BACKEND',
onSuccess: function (d) { window.location = '/thank-you'; },
onClose: function () {},
onExpired: function () {}
});
Option B — Publishable key (no backend)
No server at all. Ship your publishable key (pk_live_…) in the browser — it can only create a charge, never read, settle, or pay out. The widget calls POST /v1/checkout for you and opens the modal.
JustCryptoPay.open({
key: 'pk_live_xxx',
amount: 25,
chain: 'tron',
asset: 'USDT',
order_id: 'order-123',
onSuccess: function (d) { window.location = '/thank-you'; }
});
Option C — No-code button
No JavaScript to write. Add data-jcp-* attributes to any element and the widget wires the click automatically.
<button data-jcp-key="pk_live_xxx"
data-jcp-amount="25"
data-jcp-chain="tron"
data-jcp-asset="USDT"
data-jcp-order-id="order-123"
data-jcp-success-url="/thank-you">
Pay with crypto
</button>
Option D — Fixed-price Payment Links (tamper-proof)
The safest no-backend option. Create a Payment Link in your dashboard with a fixed amount; the price lives on our server, so a tampered browser amount is ignored entirely. Open it by link id — no publishable key needed, the link id is the capability.
JustCryptoPay.open({ link: 'plink_xxx', onSuccess: function (d) { window.location = '/thank-you'; } });
No-code button and clean shareable URL work the same way:
<button data-jcp-link="plink_xxx">Pay with crypto</button>
// or just link to it:
https://justcryptopay.io/l/plink_xxx
Shareable payment link
For invoices and emails, link straight to a hosted checkout. We create the charge and show the payment page — no code anywhere.
https://justcryptopay.io/pay/new?key=pk_live_xxx&amount=25&chain=tron&asset=USDT&order_id=order-123
sk_live_… secret key on your server only.Payouts API
Send crypto from your own server to any wallet or batch of wallets. Authenticate every call with your secret X-API-Key — the same key used for charges. This API is server-to-server only: never expose the secret key in browser or mobile code.
Origin/Referer header (that CSRF check is only for dashboard cookie sessions). Call it from your backend, e.g. Node, Python, PHP or Go.Custodial balance payouts
Fund a per-chain balance, then withdraw from it. Deposits are credited after 20 confirmations. Current limits: minimum 1, maximum 25,000 per payout; platform fee is 0% at the time of writing (the response always returns the exact fee). Supported token payouts: Tron, BSC, Polygon, Base and Solana — verify the live combinations with GET /v1/networks.
Returns your stable deposit address for that chain. Send USDT/USDC there; the watcher credits your balance after confirmations. One address per chain receives any supported token on that chain.
curl "https://justcryptopay.io/v1/payouts/deposit-address?chain=tron&asset=USDT" \
-H "X-API-Key: sk_live_your_merchant_api_key"Returns the available balance per chain/asset: {"balances":[{"chain":"tron","asset":"USDT","available":"25.000000"}]}.
Creates a withdrawal from your balance. The amount plus fee is debited atomically; the send is queued. Send an idempotency_key so retries can never pay twice — repeat the same key and you get the original payout back.
curl -X POST https://justcryptopay.io/v1/payouts \
-H "X-API-Key: sk_live_your_merchant_api_key" \
-H "Content-Type: application/json" \
-d '{"chain":"tron","asset":"USDT","destination":"T...your...address","amount":25,"idempotency_key":"payout-2026-001"}'{
"id": "po_...", "status": "queued", "chain": "tron", "asset": "USDT",
"destination": "T...", "amount": "25.000000", "fee": "0.000000",
"tx_hash": null, "idempotency_key": "payout-2026-001",
"created_at": "2026-11-30T...", "sent_at": null
}Track it with GET /v1/payouts/{id} or list with GET /v1/payouts?limit=100&status=queued. tx_hash is filled once broadcast; status becomes sent.
Non-custodial wallet payouts
Pull funds straight from your own wallet in one on-chain transaction — no custodial balance is debited. You sign an allowance once, then execute batches. Check GET /v1/payouts/config for the live chains; at the time of writing BSC is live (other chains return 503 until their router is deployed).
GET /v1/payouts/config— router, Permit2, relayer, chain id and supported tokens per chain.POST /v1/payouts/link-wallet— store the source wallet:{"chain_family":"evm","address":"0x..."}(families:evm,tron,solana).- Grant an allowance to our router from that wallet: EVM Permit2 or a plain ERC-20 approve; optionally submit an EIP-2612 signature via
POST /v1/payouts/grant-permit(gasless for you). Tron uses a TRC-20 approve; Solana uses an SPL delegate. GET /v1/payouts/allowance?chain=bsc&asset=USDT— confirm the router can pull at least your batch total.POST /v1/payouts/execute— one transaction pays every recipient plus the platform fee.
curl -X POST https://justcryptopay.io/v1/payouts/execute \
-H "X-API-Key: sk_live_your_merchant_api_key" \
-H "Content-Type: application/json" \
-d '{"chain":"bsc","asset":"USDT","recipients":[{"address":"0x...","amount":5},{"address":"0x...","amount":7.5}],"idempotency_key":"batch-2026-001"}'{"tx_hash":"0x...","status":"sent","count":2,"fee":"...","chain":"bsc","asset":"USDT"}Disconnect the stored source wallet with POST /v1/payouts/unlink-wallet {"chain_family":"evm"} (on-chain allowances remain until you revoke them in your wallet).
Payout errors
401— missing/invalidX-API-Key.403— only for cookie-session (dashboard) calls without a valid Origin/Referer; server-to-server API-key calls are exempt.422— validation, unsupported chain/asset, insufficient balance, missing linked wallet, or allowance too low.503— payouts not yet live on that chain (checkGET /v1/payouts/config).
/openapi.json. Keep sk_live_... on your server; the publishable pk_live_... key can never create or read payouts.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.
Payment states
Confirmed and settled are two distinct states — don't treat one as the other:
- confirmed — the deposit has been detected and has the required confirmations on-chain. The payer is done, but for managed acceptance the funds are not necessarily in your wallet yet. This is when
charge.confirmedfires. - settled / swept — the funds have actually been moved to your merchant wallet. This is reported separately by a
charge.settledevent that carries the settlement transaction hash and timestamp.
pending, held (for example while a prepaid balance to cover the network fee is topped up), failed or complete. A confirmed charge is not proof that funds reached your wallet — wait for charge.settled (or settlement.state = complete) before treating a payout as received. For direct acceptance the customer pays your own wallet, so there is no separate sweep.Webhook payload
| Field | Type | Description |
|---|---|---|
event | string | Event name — charge.confirmed (deposit confirmed on-chain) or charge.settled (funds swept to your wallet). |
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 for this charge (0.5% by default). |
net_amount | string | Amount due to your wallet after fee; moved when the charge settles, not at confirmation. |
asset / chain | string | Stablecoin and chain of the payment. |
tx_hash | string | On-chain hash of the customer's deposit (not the settlement sweep — see settlement.tx_hash). |
status | string | Charge status. confirmed means the deposit confirmed on-chain; settlement to your wallet is tracked separately (see settlement.state and Payment states). |
settlement.state | string | Managed settlement state: pending, held, failed or complete. Absent for direct acceptance. |
settlement.tx_hash | string | Hash of the sweep that moved funds to your wallet. Present once settled; distinct from the deposit tx_hash. |
settlement.settled_at | string | ISO-8601 time the funds were swept to your wallet. Present once settled. |
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"
}
Once the funds are swept to your wallet, a separate charge.settled event is delivered. It carries a settlement object with its own transaction hash and timestamp — distinct from the deposit above:
{
"event": "charge.settled",
"id": "chg_3Qa8Rn2kLpWv",
"order_id": "ORD-10231",
"asset": "USDT",
"chain": "tron",
"tx_hash": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855",
"status": "confirmed",
"settlement": {
"state": "complete",
"tx_hash": "a1075db55d416d3ca199f55b6084e2115b9345e16c5cf302fc80e9d5fbf5d48d",
"settled_at": "2026-11-26T12:48:10Z"
}
}
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 | Deposit confirmed on-chain — the payer is done. For managed acceptance, funds are not necessarily in your wallet yet; the charge.confirmed webhook fires here. |
| settled | Funds swept to your wallet, reported with a settlement tx hash and timestamp. Managed settlement runs through pending → held → complete (or failed); the charge.settled webhook fires on completion. |
| 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. |