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:
| Option | Best for | Server code |
|---|---|---|
| Payment links | Fixed-price products, social media, invoices sent by hand | None |
| Drop-in button | Any website: checkout opens on top of your page | None (or one API call) |
| Invoices API | Stores with a cart: one invoice per order, automatic order updates | Yes |
Base URL: https://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.
| Key | Looks like | Used for |
|---|---|---|
| Live API key | tw_sk_… | Real payments. Shown once; ask for a new one if it is lost. |
| Test API key | tw_test_… | Building and testing without real crypto. See Test mode. |
| Webhook secret | whsec_… | 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_idcan 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:
result | What happens | Webhook |
|---|---|---|
paid | The exact amount arrives. The invoice is marked paid. | invoice.paid |
underpaid | 90% arrives. The invoice stays open and the payment appears in unmatched payments. | invoice.underpaid |
overpaid | 110% arrives. Same as above. | invoice.overpaid |
expired | The payment window runs out. | invoice.expired |
curl -X POST https://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.
Payment links
A payment link has a fixed USD price. Every visit opens a fresh checkout, so one link can be paid many times. Share it anywhere: a button on your site, an Instagram bio, a WhatsApp message or an email.
https://teroway.com/l/pl_8f2c41d0a7b3e9
Add ?ref= to tag who is paying (for example a customer number). It comes back in the invoice metadata and the webhook.
https://teroway.com/l/pl_8f2c41d0a7b3e9?ref=customer-118
Create links with the payment links API, or ask us to create them for you.
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
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.
| Field | Required | Description |
|---|---|---|
amount | Yes | Price in USD as a string, "0.10" to "100000". |
order_id | No | Your order reference (max 120 chars). One invoice per order_id. |
description | No | Shown on the checkout (max 200 chars). |
callback_url | No | HTTPS URL that receives the webhook. |
success_url | No | Where the customer goes after paying. |
cancel_url | No | Where "Cancel and go back" leads. |
metadata | No | Any JSON (max 4 KB), returned in the invoice and webhook. |
network | No | Skip 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://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://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://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://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.
Returns { "invoice": {…} }. Use it to double-check an order before you ship.
Payment links API
Fields: amount (required), description, success_url, cancel_url, callback_url. Returns { "payment_link": { "id", "url", … } }.
curl -X POST https://teroway.com/v1/payment_links \ -H "Authorization: Bearer $TEROWAY_KEY" -H "Content-Type: application/json" \ -d '{"amount":"25.00","description":"Monthly plan","success_url":"https://yoursite.com/thanks"}'
Lists your links, newest first.
Switches a link off. Visitors see a "no longer active" page; invoices already opened from it still work.
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.
Payments to your addresses from the last 14 days with no invoice, each with up to 5 likely invoices (closest amount first).
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
| Event | When | What to do |
|---|---|---|
invoice.paid | The 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.expired | The 30-minute window ended without a payment. | Release stock or cancel the order. A late payment can still arrive and sends invoice.paid. |
invoice.underpaid | A 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.overpaid | Same, for 101% to 120% of the amount. | Usually accept it with assign. |
ping | You 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
Your last 100 deliveries (or one invoice's): event, status (pending, delivered, failed), attempts, last_error and the next retry time.
Sends an event again right away, for example after you fixed your endpoint. Same event id and body, fresh signature.
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,000 | Free |
| $1,000 to $50,000 | 0.5% |
| Above $50,000 | 0.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.
Your balance, status (active, grace or paused), and this month's paid volume, fees and free volume left.
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.
Every fee, top-up and credit, newest first, with the balance after each.
Invoice object
| Field | Description |
|---|---|
id | Invoice id, inv_… |
livemode | false for test-mode invoices |
order_id | Your reference, or null |
status | pending, paid or expired |
amount | Price in USD |
network | Coin and network the customer chose, or null before they choose |
pay_currency, pay_amount, pay_address | The exact coin amount and your address shown to the customer |
rate | USD per coin, locked when the coin was chosen (1 for USDT) |
received, received_coin | Value received in USD, and in the coin |
tx_hash | Blockchain transaction |
paid_late | True if it arrived after the 30-minute window |
metadata | Your JSON, plus payment_link and ref for link payments |
created_at, expires_at, paid_at | ISO 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.
| network | Coin | Detected in |
|---|---|---|
tron_usdt | USDT on TRON (TRC20) | about 1 min |
tron_trx | TRX on TRON | about 1 min |
bsc_usdt | USDT on BNB Smart Chain (BEP20) | about 1 min |
bsc_usdc | USDC on BNB Smart Chain (BEP20) | about 1 min |
bsc_bnb | BNB on BNB Smart Chain | about 1 min |
eth_usdt | USDT on Ethereum (ERC20) | about 3 min |
eth_usdc | USDC on Ethereum (ERC20) | about 3 min |
eth_eth | ETH on Ethereum | about 3 min |
polygon_usdt | USDT on Polygon | about 2 min |
polygon_usdc | USDC on Polygon | about 2 min |
base_usdc | USDC on Base | about 1 min |
base_eth | ETH on Base | about 1 min |
arb_usdt | USDT on Arbitrum One | about 1 min |
arb_usdc | USDC on Arbitrum One | about 1 min |
arb_eth | ETH on Arbitrum One | about 1 min |
btc | Bitcoin (BTC) | about 10 to 20 min |
ltc | Litecoin (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:
| Status | Meaning |
|---|---|
| 400 | Something in the request is missing or invalid; the message says what. |
| 401 | Missing or wrong API key. |
| 402 | New live checkouts are paused because your fee balance is below zero. Top up with /v1/balance/topups. |
| 404 | Not found, or it belongs to another account. |
| 409 | The action does not fit the current state (for example the invoice is already paid). |