CChainPay
Entrar

Accept BNB, ETH and tokens on a single deposit address

By default a deposit address watches one asset, for example bep20/usdt. With multiToken one address accepts the chain's native coin and every supported token on it. It fits wallets and top-up flows where users send whatever they hold.

Create a multi-token address

curl -X POST https://api.chainpay.site/deposit-address \
  -H 'content-type: application/json' \
  -d '{
    "ticker": "bnb",
    "multiToken": true,
    "callbackUrl": "https://shop.example.com/crypto-webhook?token=SECRET",
    "forwardAddress": "0xYourOwnBscWallet...",
    "externalReference": "user-42"
  }'

What the webhook tells you

Each deposit is tracked and swept separately, and the webhook describes the asset that actually arrived:

{
  "status": "confirmed",
  "externalReference": "user-42",
  "chain": "bsc",
  "tokenSymbol": "BNB",
  "tokenAddress": null,
  "isNative": true,
  "amount": "0.842000000000000000",
  "txHash": "0x…"
}

For a token transfer isNative is false and tokenSymbol / tokenAddress identify the token. Branch on those fields:

function handleDeposit(event) {
  if (event.status !== 'confirmed') return;
  const { externalReference, tokenSymbol, isNative, amount } = event;
  // credit `amount` of `tokenSymbol` to the user identified by externalReference
  creditBalance(externalReference, tokenSymbol, amount);
}

Rules to know

Related