API reference

Integrate checkout in minutes with a simple REST API. Ready-made WooCommerce and WHMCS plugins are available in your dashboard.

Authentication

Send your API key in the TSPAY-API-KEY header with every request.

API URL: https://www.tsgateway.tshost.shop/api

Create a payment

POST https://www.tsgateway.tshost.shop/api/checkout-v2

curl -X POST https://www.tsgateway.tshost.shop/api/checkout-v2 \
  -H "TSPAY-API-KEY: YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "amount": "500",
    "currency": "BDT",
    "full_name": "Rahim",
    "email": "rahim@example.com",
    "metadata": {"order_id": "1001"},
    "redirect_url": "https://yoursite.com/success",
    "cancel_url": "https://yoursite.com/cancel",
    "webhook_url": "https://yoursite.com/webhook"
  }'

Response:

{"status": true, "message": "Payment Url", "payment_url": "https://www.tsgateway.tshost.shop/pay.php?id=..."}

Redirect your customer to payment_url.

currency is optional: BDT (default), USD or INR. The customer can pay with any of your gateways; amounts are converted using the site's exchange rates.

Verify a payment

After payment the customer returns to your redirect_url with ?invoice_id=.... Verify it on your server:

curl -X POST https://www.tsgateway.tshost.shop/api/verify-payment \
  -H "TSPAY-API-KEY: YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"invoice_id": "INVOICE_ID"}'
{
  "full_name": "Rahim", "email": "rahim@example.com",
  "amount": "500.00", "fee": "0.00", "charged_amount": "500.00",
  "invoice_id": "...", "metadata": {"order_id": "1001"},
  "payment_method": "bkash", "sender_number": "01XXXXXXXXX",
  "transaction_id": "9AB1CD2EF3", "date": "2026-10-13 12:00:00",
  "status": "COMPLETED"
}

Only trust status = COMPLETED.

Telegram bots (no domain, no webhook)

Your bot does not need a website. Create a payment, send the payment_url as a button, and poll for completed payments from a cron job.

Extra fields for checkout-v2: ref (your own user id, returned later) and telegram_chat_id (the customer's chat; we message them in your bot when they pay - set your bot token in Notifications).

curl -X POST https://www.tsgateway.tshost.shop/api/payments \
  -H "TSPAY-API-KEY: YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"after_id": 0}'

{"status": true, "last_id": 12, "payments": [ {"event_id": 12, "ref": "123456789", "amount": "500.00", "invoice_id": "...", "status": "COMPLETED"} ]}

Store last_id and send it as after_id next time. Credit each invoice_id only once. You can also pass "ref" or "invoice_id" to filter.

Webhook

If you pass webhook_url, we send a POST with the same JSON as above and the header TSPAY-API-KEY when a payment completes. Compare that header with your API key before accepting it.

Signed webhooks (recommended). Every webhook also carries X-TSPay-Timestamp and X-TSPay-Signature. The signature is sha256= followed by the HMAC SHA-256 of timestamp + "." + raw request body, using your API key as the secret. Reject the request if the signature does not match or the timestamp is more than 5 minutes old.

Security checklist

Crypto networks

These gateways are checked on the blockchain automatically. The customer sends the exact amount shown to your wallet and the invoice completes by itself, usually within a few minutes. The payment_method value in the verify response is the key below.

GatewayNetworkMethod key
USDT (TRC20)TRC20usdt_trc20
USDT (BEP20)BEP20usdt_bep20
USDT (ERC20)ERC20usdt_erc20
TRON (TRX)TRONtrx
BNB (BEP20)BEP20bnb_bep20
Ethereum (ERC20)ERC20eth_erc20
DOGEDogecoindoge
BTCBitcoinbtc
LTCLitecoinltc
Solana (SOL)Solanasol
TON (Toncoin)TONton
Arbitrum (ETH)Arbitrum Onearb_eth
Base (ETH)Basebase_eth
Polygon (POL)Polygonpol_polygon
Avalanche (AVAX)Avalanche C-Chainavax_c
Robinhood Chain (ETH)Robinhood Chainrobinhood_eth
USDT (Polygon)Polygonusdt_polygon
USDC (Polygon)Polygonusdc_polygon
USDT (Arbitrum)Arbitrum Oneusdt_arb
USDC (Arbitrum)Arbitrum Oneusdc_arb
USDC (Base)Baseusdc_base
USDT (Avalanche)Avalanche C-Chainusdt_avax
USDC (Avalanche)Avalanche C-Chainusdc_avax
Chainlink (LINK, ERC20)Ethereum (ERC20)link_erc20
Uniswap (UNI, ERC20)Ethereum (ERC20)uni_erc20
Shiba Inu (SHIB, ERC20)Ethereum (ERC20)shib_erc20
DAI (ERC20)Ethereum (ERC20)dai_erc20
Aave (AAVE, ERC20)Ethereum (ERC20)aave_erc20
Pepe (PEPE, ERC20)Ethereum (ERC20)pepe_erc20
USDC (ERC20)Ethereum (ERC20)usdc_erc20
BUSD (BEP20)BEP20busd_bep20
PancakeSwap (CAKE, BEP20)BEP20cake_bep20
Ethereum (ETH, BEP20)BEP20ethb_bep20
Polygon (MATIC, ERC20)Ethereum (ERC20)matic_erc20
ApeCoin (APE, ERC20)Ethereum (ERC20)ape_erc20
Lido DAO (LDO, ERC20)Ethereum (ERC20)ldo_erc20
Maker (MKR, ERC20)Ethereum (ERC20)mkr_erc20
Curve DAO (CRV, ERC20)Ethereum (ERC20)crv_erc20
Synthetix (SNX, ERC20)Ethereum (ERC20)snx_erc20
The Graph (GRT, ERC20)Ethereum (ERC20)grt_erc20
Decentraland (MANA, ERC20)Ethereum (ERC20)mana_erc20
The Sandbox (SAND, ERC20)Ethereum (ERC20)sand_erc20
Chiliz (CHZ, ERC20)Ethereum (ERC20)chz_erc20
Ethereum Name Service (ENS, ERC20)Ethereum (ERC20)ens_erc20
1inch (1INCH, ERC20)Ethereum (ERC20)inch_erc20
Compound (COMP, ERC20)Ethereum (ERC20)comp_erc20
yearn.finance (YFI, ERC20)Ethereum (ERC20)yfi_erc20
Basic Attention Token (BAT, ERC20)Ethereum (ERC20)bat_erc20
DOGE (BEP20)BEP20doge_bep20
Chainlink (LINK, BEP20)BEP20link_bep20
XRP (BEP20)BEP20xrp_bep20
Cardano (ADA, BEP20)BEP20ada_bep20
Polkadot (DOT, BEP20)BEP20dot_bep20
FTM (Ethereum (ERC20))Ethereum (ERC20)ftm_erc20
SUSHI (Ethereum (ERC20))Ethereum (ERC20)sushi_erc20
ZRX (Ethereum (ERC20))Ethereum (ERC20)zrx_erc20
KNC (Ethereum (ERC20))Ethereum (ERC20)knc_erc20
BAL (Ethereum (ERC20))Ethereum (ERC20)bal_erc20
RNDR (Ethereum (ERC20))Ethereum (ERC20)rndr_erc20
IMX (Ethereum (ERC20))Ethereum (ERC20)imx_erc20
QNT (Ethereum (ERC20))Ethereum (ERC20)qnt_erc20
AXS (Ethereum (ERC20))Ethereum (ERC20)axs_erc20
FLOKI (Ethereum (ERC20))Ethereum (ERC20)floki_erc20
LRC (Ethereum (ERC20))Ethereum (ERC20)lrc_erc20
ENJ (Ethereum (ERC20))Ethereum (ERC20)enj_erc20
SHIB (BEP20)BEP20shib_bep20
UNI (BEP20)BEP20uni_bep20
AAVE (BEP20)BEP20aave_bep20
USDC (BEP20)BEP20usdc_bep20
TWT (BEP20)BEP20twt_bep20
BTCB (BEP20)BEP20btcb_bep20
AVAX (BEP20)BEP20avax_bep20
SOL (BEP20)BEP20sol_bep20
BONK (Solana)Solanabonk_sol
dogwifhat (WIF, Solana)Solanawif_sol
Jupiter (JUP, Solana)Solanajup_sol
PayPal USD (PYUSD, ERC20)Ethereum (ERC20)pyusd_erc20
USDS (ERC20)Ethereum (ERC20)usds_erc20
Ethena USDe (ERC20)Ethereum (ERC20)usde_erc20
First Digital USD (FDUSD, ERC20)Ethereum (ERC20)fdusd_erc20
Arbitrum (ARB, Arbitrum One)Arbitrum Onearb_arbitrum
GMX (Arbitrum One)Arbitrum Onegmx_arbitrum
DAI (Arbitrum One)Arbitrum Onedai_arbitrum
BRETT (Base)Basebrett_base
ARPA (BEP20)BEP20arpa_bep20
Beefy (BIFI, ERC20)Ethereum (ERC20)bifi_erc20
Poolz Finance (POOLX, BEP20)BEP20poolx_bep20
SPACE ID (ID, BEP20)BEP20id_bep20
Conflux (bCFX, BEP20)BEP20cfx_bep20
Baby Doge (BABYDOGE, BEP20)BEP20babydoge_bep20
Bitgert (BRISE, BEP20)BEP20brise_bep20
Bridge Oracle (BRG, BEP20)BEP20brg_bep20
ChainGPT (CGPT, BEP20)BEP20cgpt_bep20
Mog Coin (MOG, ERC20)Ethereum (ERC20)mog_erc20
SPX6900 (SPX, ERC20)Ethereum (ERC20)spx_erc20
Bad Idea AI (BAD, ERC20)Ethereum (ERC20)bad_erc20
USDT (Solana)Solanausdt_sol
USDC (Solana)Solanausdc_sol
USDT (TON)TONusdt_ton