// developers

Stablecoin payments in one API call.

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.

●https://api.tracepayhq.com/v1
try it · POST /v1/paymentstest mode
simulated · nothing is charged

        
201 Createdresponse

      

Your first payment in four steps.

Everything below runs in test mode with free testnet tokens. Swap in your live key when you're ready.

1about 1 minute

Get your API keys

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.

testtp_test_4f9c••••••••••••••••a81e
livetp_live_••••••••••••••••••••••••
.env
TRACEPAY_KEY=tp_test_your_key_here
TRACEPAY_WEBHOOK_SECRET=whsec_your_secret_here
2one request

Create a payment

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" });
3one redirect

Send your customer to the checkout

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.

checkout.js
// express route
app.post("/pay", async (req, res) => {
  const payment = await createPayment(req.body.orderId);
  res.redirect(303, payment.checkout_url);
});
4the important one

Fulfil the order from the webhook

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.

webhook.js
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);
});

Every state, as a webhook.

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.

POST /webhooks/tracepay · payment.paid

        

SDKs and plugins.

Use an official library, or call the REST API directly from anything that speaks HTTPS.

JSavailable

Node.js

npm i @tracepay/node
PHPavailable

PHP

composer require tracepay/tracepay-php
WCavailable

WooCommerce

Plugins → Add new → "Trace Pay HQ"
PYcoming soon

Python

pip install tracepay

Safe to retry

Send an Idempotency-Key with any write. Repeat the request as often as you like and you'll only ever get one payment.

Test mode everywhere

Test keys run on Tron Nile, Sepolia, BSC testnet and Solana devnet. Same API, same webhooks, no real money.

Versioned and stable

Everything lives under /v1. We add fields without breaking old ones, and announce any change well ahead.

Ship it this afternoon.

Grab a test key, run the quickstart and see a webhook land on your server. Your first 10 live payments are free.