Developers

Accept crypto on your website

Teroway gives every order a hosted checkout. Your customer picks a coin, sends the exact amount to your own wallet, and Teroway confirms it on-chain and tells your site. Teroway never holds funds or keys.

Pick the integration that fits:

OptionBest forServer code
Payment linksFixed-price products, social media, invoices sent by handNone
Drop-in buttonAny website: checkout opens on top of your pageNone (or one API call)
Invoices APIStores with a cart: one invoice per order, automatic order updatesYes

Base URL: https://www.teroway.com

Your keys

When your account is set up you receive two secrets. Keep both on your server only, never in browser code or a public repository.

KeyLooks likeUsed for
Live API keytw_sk_…Real payments. Shown once; ask for a new one if it is lost.
Test API keytw_test_…Building and testing without real crypto. See Test mode.
Webhook secretwhsec_…Checking that webhooks really come from Teroway.

No account yet? Request API access.

Test mode

Build your whole integration before any real money moves. Use your tw_test_… key exactly like the live key: every endpoint works the same, and webhooks are sent and signed the same way, with "livemode": false.

  • Test invoices, payment links and payments are separate from live ones. A test key never sees live data and the other way round, and the same order_id can exist in both.
  • Test checkouts show every coin and network, a "Test mode" banner, and an address that is not a real wallet. Nothing is watched on a blockchain.
  • Pay a test invoice with the buttons on its checkout page, or from your code:
POST/v1/invoices/:id/simulate
resultWhat happensWebhook
paidThe exact amount arrives. The invoice is marked paid.invoice.paid
underpaid90% arrives. The invoice stays open and the payment appears in unmatched payments.invoice.underpaid
overpaid110% arrives. Same as above.invoice.overpaid
expiredThe payment window runs out.invoice.expired
curl -X POST https://www.teroway.com/v1/invoices/inv_…/simulate   -H "Authorization: Bearer $TEROWAY_TEST_KEY" -H "Content-Type: application/json"   -d '{"result":"paid"}'

The invoice needs a coin first: pass network when you create it, or pick one on the test checkout. When everything works, swap in your live key. Nothing else changes.

Drop-in button

Add the script once, then mark any button or link. The checkout opens in a window on top of your page; when the payment confirms, the customer is sent to your success_url.

<!-- 1. Add once, before </body> -->
<script src="https://www.teroway.com/teroway.js" defer></script>

<!-- 2a. A payment link (no server code) -->
<button class="teroway-button" data-teroway-link="pl_8f2c41d0a7b3e9">Pay with crypto</button>

<!-- 2b. Or an invoice your server created (checkout_url from POST /v1/invoices) -->
<button class="teroway-button" data-teroway-checkout="https://www.teroway.com/c/inv_…">Pay with crypto</button>

class="teroway-button" is optional and gives the button the Teroway style. Use your own classes if you prefer.

Listen for the payment in JavaScript

window.addEventListener('teroway:paid', e => {
  console.log('Paid', e.detail.invoice)
  // call e.preventDefault() to stay on the page instead of going to success_url
})

// Or open a checkout yourself
Teroway.open('https://www.teroway.com/c/inv_…')
The browser event is for a smooth experience only. Always confirm the order on your server from the webhook or by fetching the invoice: anything in the browser can be faked.

Authentication

Send your API key as a Bearer token on every request. Requests and responses are JSON.

Authorization: Bearer tw_sk_…
Content-Type: application/json

Invoices

POST/v1/invoices

Creates an invoice and returns its checkout_url. Send the customer there (redirect, link or the drop-in button). If you send an order_id that already has an invoice, you get the same invoice back, so retries are safe.

FieldRequiredDescription
amountYesPrice in USD as a string, "0.10" to "100000".
order_idNoYour order reference (max 120 chars). One invoice per order_id.
descriptionNoShown on the checkout (max 200 chars).
callback_urlNoHTTPS URL that receives the webhook.
success_urlNoWhere the customer goes after paying.
cancel_urlNoWhere "Cancel and go back" leads.
metadataNoAny JSON (max 4 KB), returned in the invoice and webhook.
networkNoSkip the coin picker by naming the network, for example tron_usdt or base_usdc. All values are in Coins and networks.
curl -X POST https://www.teroway.com/v1/invoices \
  -H "Authorization: Bearer $TEROWAY_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "amount": "49.00",
    "order_id": "1042",
    "description": "Order #1042",
    "callback_url": "https://yourshop.com/teroway/webhook",
    "success_url": "https://yourshop.com/thanks"
  }'
const res = await fetch('https://www.teroway.com/v1/invoices', {
  method: 'POST',
  headers: { Authorization: `Bearer ${process.env.TEROWAY_KEY}`, 'Content-Type': 'application/json' },
  body: JSON.stringify({ amount: '49.00', order_id: '1042', callback_url: 'https://yourshop.com/teroway/webhook', success_url: 'https://yourshop.com/thanks' }),
})
const { invoice, checkout_url } = await res.json()
// redirect the customer to checkout_url
$ch = curl_init('https://www.teroway.com/v1/invoices');
curl_setopt_array($ch, [
  CURLOPT_POST => true, CURLOPT_RETURNTRANSFER => true,
  CURLOPT_HTTPHEADER => ['Authorization: Bearer ' . getenv('TEROWAY_KEY'), 'Content-Type: application/json'],
  CURLOPT_POSTFIELDS => json_encode(['amount' => '49.00', 'order_id' => '1042', 'callback_url' => 'https://yourshop.com/teroway/webhook']),
]);
$data = json_decode(curl_exec($ch), true);
header('Location: ' . $data['checkout_url']);

Response 201:

{ "invoice": { "id": "inv_5d1e…", "status": "pending", "amount": 49, … },
  "checkout_url": "https://www.teroway.com/c/inv_5d1e…" }

Invoices stay open for 30 minutes. A payment that arrives late (up to 24 hours for USDT, 3 hours for other coins) is still matched and marked paid_late.

GET/v1/invoices/:id

Returns { "invoice": {…} }. Use it to double-check an order before you ship.

Unmatched payments

If a customer sends the wrong amount, or pays after the late window, the money still reaches your wallet but cannot be matched automatically.

GET/v1/payments/unmatched

Payments to your addresses from the last 14 days with no invoice, each with up to 5 likely invoices (closest amount first).

POST/v1/payments/:id/assign

Body { "invoice_id": "inv_…" }. Marks that invoice paid with the amount that actually arrived and sends the normal invoice.paid webhook. A BTC, ETH, BNB, TRX or LTC payment can only go to an invoice opened for the same coin.

Webhooks

When something happens to an invoice with a callback_url, Teroway sends a POST with this body:

{
  "id": "evt_3f9c…",
  "event": "invoice.paid",
  "livemode": true,
  "invoice": { "id": "inv_5d1e…", "order_id": "1042", "status": "paid", "amount": 49, "received": 49.137, … },
  "sent_at": "2026-11-24T10:15:02.000Z"
}

Reply with any 2xx status. If your server is down or returns an error, Teroway retries after 1 minute, 5 minutes, 30 minutes, 2 hours, 12 hours and 24 hours, then stops. Each attempt waits up to 10 seconds for your reply. Your handler may receive the same event twice: use the event id (or the order's paid status) to ignore repeats. The X-Teroway-Event header carries the event name too.

Event types

EventWhenWhat to do
invoice.paidThe payment confirmed on-chain (or you assigned a payment to the invoice). The invoice field paid_late is true if it arrived after the 30-minute window.Fulfil the order.
invoice.expiredThe 30-minute window ended without a payment.Release stock or cancel the order. A late payment can still arrive and sends invoice.paid.
invoice.underpaidA payment of 80% to 99% of the amount reached the invoice's address in its time window, and no other open invoice fits.Ask the customer to send the rest, or accept it with assign.
invoice.overpaidSame, for 101% to 120% of the amount.Usually accept it with assign.
pingYou called /v1/webhooks/ping.Reply 2xx.

invoice.underpaid and invoice.overpaid include a payment object (id, network, coin, amount, tx_hash, explorer). They are sent at most once per invoice. They are a strong hint, not proof: an unrelated payment of a similar amount to the same wallet looks the same, so check before you assign it.

Verify signatures

Every webhook has a header X-Teroway-Signature: t=<ms>,v1=<hex>. v1 is HMAC-SHA256 of "<t>.<raw body>" using your webhook secret. Compute it over the raw body, before any JSON parsing, and reject requests older than 5 minutes.

import crypto from 'node:crypto'

export function verifyTeroway(rawBody, header, secret) {
  const parts = Object.fromEntries(header.split(',').map(p => p.split('=')))
  if (Math.abs(Date.now() - Number(parts.t)) > 5 * 60_000) return false
  const expected = crypto.createHmac('sha256', secret).update(`${parts.t}.${rawBody}`).digest('hex')
  return parts.v1?.length === expected.length &&
    crypto.timingSafeEqual(Buffer.from(parts.v1), Buffer.from(expected))
}
$raw = file_get_contents('php://input');
parse_str(str_replace(',', '&', $_SERVER['HTTP_X_TEROWAY_SIGNATURE'] ?? ''), $p);
$expected = hash_hmac('sha256', $p['t'] . '.' . $raw, getenv('TEROWAY_WEBHOOK_SECRET'));
if (!hash_equals($expected, $p['v1'] ?? '') || abs(time() * 1000 - (int)$p['t']) > 300000) {
  http_response_code(400); exit;
}
$event = json_decode($raw, true);
if ($event['event'] === 'invoice.paid') { /* mark order $event['invoice']['order_id'] as paid */ }
http_response_code(200);

Webhook tools

GET/v1/webhooks?invoice_id=inv_…

Your last 100 deliveries (or one invoice's): event, status (pending, delivered, failed), attempts, last_error and the next retry time.

POST/v1/webhooks/:id/resend

Sends an event again right away, for example after you fixed your endpoint. Same event id and body, fresh signature.

POST/v1/webhooks/ping

Body { "url": "https://…" }. Sends a signed ping event to that URL now and returns { "ok", "status", "ms" }, so you can test your endpoint and signature check before taking payments.

Pricing and fee balance

Paid volume per calendar month (UTC)Fee
First $1,000Free
$1,000 to $50,0000.5%
Above $50,0000.3%

Rates apply to the part of your volume inside each band, like tax brackets. Volume is what actually arrived (in USD at the invoice's locked rate). No setup or monthly fee; test mode is free.

Teroway never holds your money, so fees come out of a prepaid fee balance. Each paid live invoice deducts its fee. If the balance goes below zero, new live checkouts keep working for 3 days, then POST /v1/invoices returns 402 until you top up. Invoices that already exist can always be paid. We email you when the balance goes below zero.

GET/v1/balance

Your balance, status (active, grace or paused), and this month's paid volume, fees and free volume left.

POST/v1/balance/topups

Body { "amount": "50.00", "success_url"?: "https://…" } ($10 to $10,000). Returns a normal Teroway checkout; pay it in USDT or USDC and the balance is credited with what arrives as soon as it confirms. Use your live key.

GET/v1/balance/ledger

Every fee, top-up and credit, newest first, with the balance after each.

Invoice object

FieldDescription
idInvoice id, inv_…
livemodefalse for test-mode invoices
order_idYour reference, or null
statuspending, paid or expired
amountPrice in USD
networkCoin and network the customer chose, or null before they choose
pay_currency, pay_amount, pay_addressThe exact coin amount and your address shown to the customer
rateUSD per coin, locked when the coin was chosen (1 for USDT)
received, received_coinValue received in USD, and in the coin
tx_hashBlockchain transaction
paid_lateTrue if it arrived after the 30-minute window
metadataYour JSON, plus payment_link and ref for link payments
created_at, expires_at, paid_atISO 8601 times

Coins and networks

17 options on 8 blockchains. Stablecoins are worth $1 each; other coins are converted from your USD price at a rate locked for 30 minutes.

networkCoinDetected in
tron_usdtUSDT on TRON (TRC20)about 1 min
tron_trxTRX on TRONabout 1 min
bsc_usdtUSDT on BNB Smart Chain (BEP20)about 1 min
bsc_usdcUSDC on BNB Smart Chain (BEP20)about 1 min
bsc_bnbBNB on BNB Smart Chainabout 1 min
eth_usdtUSDT on Ethereum (ERC20)about 3 min
eth_usdcUSDC on Ethereum (ERC20)about 3 min
eth_ethETH on Ethereumabout 3 min
polygon_usdtUSDT on Polygonabout 2 min
polygon_usdcUSDC on Polygonabout 2 min
base_usdcUSDC on Baseabout 1 min
base_ethETH on Baseabout 1 min
arb_usdtUSDT on Arbitrum Oneabout 1 min
arb_usdcUSDC on Arbitrum Oneabout 1 min
arb_ethETH on Arbitrum Oneabout 1 min
btcBitcoin (BTC)about 10 to 20 min
ltcLitecoin (LTC)about 3 min

Only the networks you gave us a receiving address for appear at your checkout. One EVM address (0x…) works on Ethereum, BNB Chain, Polygon, Base and Arbitrum, so you can switch all of them on with a single wallet.

Errors

Errors return a JSON body { "error": "message" } with one of these statuses:

StatusMeaning
400Something in the request is missing or invalid; the message says what.
401Missing or wrong API key.
402New live checkouts are paused because your fee balance is below zero. Top up with /v1/balance/topups.
404Not found, or it belongs to another account.
409The action does not fit the current state (for example the invoice is already paid).