API ReferenceWooCommerceSDKssoonWebhookssoon

On-chain

Get a receiving address

POST/api/v2/onchain/next-address

A fresh on-chain address for a sale, derived from the merchant's own xpub. Never returns the same address twice, so payments stay attributable and private.

  • A store issuing an address authenticates like any other store call — API key or merchant JWT.
  • The address belongs to the merchant's own wallet. Funds sent to it go straight there; Trevi cannot spend from it and never sees the coins except on the public chain.
  • Each call advances the derivation index, so treat the address as consumed even if the customer walks away.
  • 503 code: "disabled" when on-chain receiving is switched off; 400/422 mirror the connect errors when no usable xpub is registered.

Authentication

Accepts either an API key (X-API-Key) or a dashboard JWT (Authorization: Bearer …).

POST/api/v2/onchain/next-address
curl --request POST "https://api.trevi.cash/api/v2/onchain/next-address" \
  --header "X-API-Key: $TREVI_API_KEY"
200Sample response
{
  "success": true,
  "address": "bc1q…",
  "index": 7
}