Quickstart

Create a payment address, show it to your customer, and confirm the order from the signed callback.

1. Create an address

Call /{ticker}/create/ with the URL that should be notified and the wallet that should receive the money. Put your own order id in the callback URL: it comes back on every callback.

Terminal
curl "https://api.trezorpay.com/trc20/usdt/create/?callback=https%3A%2F%2Fshop.example%2Fpaid%3Forder%3D1042&address=TJzXZQhbhJB3dA2TmxmvyPxk2nKsmZ6yWf&pending=1"
Response
{
  "status": "success",
  "address_in": "TN7Zbu4UwtKneYDJyDKXkSorVu95hsE3q4",
  "address_out": "TJzXZQhbhJB3dA2TmxmvyPxk2nKsmZ6yWf",
  "callback_url": "https://shop.example/paid?order=1042",
  "minimum_transaction_coin": "10.00000000",
  "priority": "default"
}

Show address_in to your customer, with a QR code from /{ticker}/qrcode/ if you like. Payments below minimum_transaction_coin are recorded but never forwarded.

2. Receive the callback

When the payment arrives (with pending=1) and again once it has been forwarded, we call your URL:

GET https://shop.example/paid?order=1042&uuid=…&address_in=TN7Z…&address_out=TJzX…
    &txid_in=…&txid_out=…&value_coin=250&value_forwarded_coin=244.39&fee_coin=2.5
    &coin=trc20_usdt&price=1&pending=0&result=sent

3. Verify and acknowledge

Check the x-ca-signature header with our public key, mark the order paid when pending=0, and answer *ok*.

server.js (Express)
import { createVerify } from 'node:crypto'
import express from 'express'

const { pubkey } = await fetch('https://api.trezorpay.com/pubkey/').then((r) => r.json())
const app = express()

app.get('/paid', (req, res) => {
  const url = `https://${req.headers.host}${req.originalUrl}`
  const valid = createVerify('sha256')
    .update(url)
    .verify(pubkey, req.headers['x-ca-signature'], 'base64')
  if (!valid) return res.status(401).end()

  if (req.query.pending === '0') {
    // value_forwarded_coin has reached your wallet: fulfil order req.query.order
  }
  res.send('*ok*')
})

Deduplicate on uuid

A payment can be delivered more than once (retries). uuid is identical on the pending and the confirmed callback of one payment: store it and ignore repeats.

On this page