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
https://justcryptopay.com
Protocol
REST + JSON
Auth
API key header
Fee
0.5% flat
Custody
Non-custodial

Supported networks

Each charge gets a unique deposit address on the chain you request. Stablecoins and chains currently accepted:

TronTRC-20 · USDT BNB Smart ChainBEP-20 · USDT/USDC PolygonUSDT/USDC BaseUSDT/USDC SolanaUSDT/USDC

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.

Header
X-API-Key: sk_live_your_merchant_api_key
🔐
Requests over plain HTTP, or with a missing or invalid key, are rejected with 401 unauthorized. Always call the API over HTTPS.

Create a charge

POST/v1/charges

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

FieldTypeRequiredDescription
amount_usdstringYesAmount to collect in USD, as a decimal string. Example "29.99".
chainstringYesOne of tron, polygon, bsc, base, solana.
assetstringYesUSDT or USDC (Tron is USDT only).
order_idstringNoYour own reference. Echoed back and included in the webhook.
metadataobjectNoArbitrary key/value object stored with the charge.

Example request

cURL
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

JSON
{
  "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..."
}
📍
The 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.js — fetch
// 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);

Fetch a charge

GET/v1/charges/{id}

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
curl https://justcryptopay.com/v1/charges/chg_3Qa8Rn2kLpWv \
  -H "X-API-Key: sk_live_your_merchant_api_key"

Get networks

GET/v1/networks

Returns the chain/asset combinations your account can accept. Use it to render a payment-method picker without hard-coding the list.

cURL
curl https://justcryptopay.com/v1/networks \
  -H "X-API-Key: sk_live_your_merchant_api_key"

Example response

JSON
{
  "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.

Redirect
// after creating the charge
res.redirect(charge.pay_url);
// -> https://justcryptopay.com/pay/chg_3Qa8Rn2kLpWv
🧩
Prefer your own UI? Every field you need is on the charge object: 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

FieldTypeDescription
eventstringEvent name, e.g. charge.confirmed.
idstringThe charge id.
order_idstringYour reference, if you supplied one.
amount_usdstringRequested USD amount.
received_amountstringToken amount actually received.
fee_amountstringPlatform fee deducted (0.5% by default).
net_amountstringAmount settled to your wallet, after fee.
asset / chainstringStablecoin and chain of the payment.
tx_hashstringOn-chain transaction hash.
statusstringCharge status, confirmed for a paid charge.

Example webhook body

JSON · POST to your URL
{
  "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"
}
⚠️
Respond 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.

Header
X-JCP-Signature: 9f1c0b…e7a2   # hex HMAC-SHA256 of the raw body
Node.js — Express
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);
  }
);
🛡️
Always hash the raw, unparsed body. Re-serializing JSON can change byte order or spacing and break the signature. Reject on mismatch before doing any business logic.

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.

StatusMeaning
pendingCharge created, waiting for the deposit to arrive and confirm.
confirmingDeposit seen on-chain, waiting for the required confirmations.
confirmedPayment settled to your wallet. The webhook fires on this state.
expiredexpires_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.

JSON · 422
{
  "error": "invalid_request",
  "message": "chain must be one of: tron, polygon, bsc, base, solana"
}
HTTPerrorWhen
400bad_requestMalformed JSON or missing body.
401unauthorizedMissing or invalid X-API-Key.
404not_foundNo charge matches the given id.
422invalid_requestA field failed validation (e.g. unsupported chain/asset pair).
429rate_limitedToo many requests. Back off and retry.
500server_errorSomething went wrong on our side. Safe to retry idempotent reads.
✅
Ready to build? Grab your API key and webhook secret from the dashboard, then create your first charge against the live endpoint.