Create a payment, send your customer to the checkout, and get a signed webhook when it's paid. A plain REST API that works the way you'd expect.
Everything below runs in test mode with free testnet tokens. Swap in your live key when you're ready.
Once your application is approved, sign in and open Settings → API keys. You get a test key and a live key. Keep both on your server, never in a browser or app.
tp_test_4f9c••••••••••••••••a81etp_live_••••••••••••••••••••••••TRACEPAY_KEY=tp_test_your_key_here TRACEPAY_WEBHOOK_SECRET=whsec_your_secret_here
Send the amount in US dollars, the tokens and networks you accept, and your own order ID. Add an Idempotency-Key so retries never create a second payment.
import TracePay from "@tracepay/node"; const tracepay = new TracePay(process.env.TRACEPAY_KEY); const payment = await tracepay.payments.create({ amount: "149.00", currency: "USD", accept: ["USDT", "USDC"], networks: ["tron", "solana"], order_id: "NW-20418", redirect_url: "https://shop.example/thanks", }, { idempotencyKey: "NW-20418" });
$tracepay = new \TracePay\Client(getenv('TRACEPAY_KEY')); $payment = $tracepay->payments->create([ 'amount' => '149.00', 'currency' => 'USD', 'accept' => ['USDT', 'USDC'], 'networks' => ['tron', 'solana'], 'order_id' => 'NW-20418', 'redirect_url' => 'https://shop.example/thanks', ], ['idempotency_key' => 'NW-20418']);
curl https://api.tracepayhq.com/v1/payments \ -H "Authorization: Bearer $TRACEPAY_KEY" \ -H "Idempotency-Key: NW-20418" \ -d amount=149.00 \ -d currency=USD \ -d "accept[]=USDT" -d "accept[]=USDC" \ -d "networks[]=tron" -d "networks[]=solana" \ -d order_id=NW-20418 \ -d redirect_url=https://shop.example/thanks
Redirect to checkout_url. We handle the token and network choice, the QR code and the countdown, then send the customer back to your redirect_url.
// express route app.post("/pay", async (req, res) => { const payment = await createPayment(req.body.orderId); res.redirect(303, payment.checkout_url); });
Don't trust the redirect alone. Verify the TracePay-Signature header, then mark the order paid when you receive payment.paid. Reply with any 2xx and we stop retrying.
import crypto from "node:crypto"; app.post("/webhooks/tracepay", express.raw({ type: "*/*" }), (req, res) => { const [t, v1] = req.get("TracePay-Signature").split(",").map(p => p.split("=")[1]); const expected = crypto.createHmac("sha256", process.env.TRACEPAY_WEBHOOK_SECRET) .update(`${t}.${req.body}`).digest("hex"); if (!v1 || v1.length !== expected.length || !crypto.timingSafeEqual(Buffer.from(v1), Buffer.from(expected))) return res.sendStatus(400); const event = JSON.parse(req.body); if (event.type === "payment.paid") orders.markPaid(event.data.order_id); res.sendStatus(200); });
Each payment moves through a small set of states. You get an event for every change, signed and retried with backoff for up to three days.
Use an official library, or call the REST API directly from anything that speaks HTTPS.
npm i @tracepay/nodecomposer require tracepay/tracepay-phpPlugins → Add new → "Trace Pay HQ"pip install tracepaySend an Idempotency-Key with any write. Repeat the request as often as you like and you'll only ever get one payment.
Test keys run on Tron Nile, Sepolia, BSC testnet and Solana devnet. Same API, same webhooks, no real money.
Everything lives under /v1. We add fields without breaking old ones, and announce any change well ahead.
Grab a test key, run the quickstart and see a webhook land on your server. Your first 10 live payments are free.