easyway
Sign inCreate free account

Price a crypto invoice in USD or in the coin itself

Every easyway invoice has a price and a currency, and the currency decides who carries the exchange rate. Price it in USD and the customer pays whatever amount of their chosen coin is worth that many dollars at checkout. Price it in a coin, for example USDT_TRC20, and the customer pays exactly that amount of that coin. Both are one field on POST /v1/invoices; this post shows what each one does and when to use it.

The two options side by side

Priced in USDPriced in a coin (USDT_TRC20)
The amount you sendDollars, e.g. 49.00Coin units, e.g. 250 USDT
Coins the customer can pay withEvery enabled coin, or the ones in allowed_assetsOnly that coin, on that network
When the crypto amount is fixedWhen the customer picks a coin on the checkoutAt once; the 201 response already has the address
What stays lockedThe coin amount, from the coin choice until expires_atThe coin amount, from the start

How a USD invoice gets its crypto amount

A USD invoice is created without a coin. When the customer selects one on the hosted checkout, the gateway divides the dollar price by that coin's current USD rate and rounds the result up: to 6 decimals for stablecoins and 8 for everything else. That amount, the deposit address and the rate are saved on the invoice and returned as pay_amount, pay_address and rate. They stay fixed until expires_at, which you control with lifetime (5 to 1440 minutes, 60 by default).

Stablecoins are priced at exactly 1 USD, so a 49.00 USD invoice paid in USDT or USDC asks for 49.000000. For everything else the rate comes from three sources, CoinGecko, KuCoin and Coinbase, refreshed every minute. The gateway takes the median, drops any source more than 3% away from it, and keeps the old price if two sources disagree. A live invoice is never quoted from a price older than 15 minutes: if no fresh price is available, selecting the coin fails with 503 rate_unavailable instead of quoting a stale number.

curl -X POST https://api.easyway.cash/v1/invoices \
  -H "Authorization: Bearer $EASYWAY_API_KEY" \
  -H "Idempotency-Key: order-4101" \
  -H "Content-Type: application/json" \
  -d '{"amount":"49.00","currency":"USD","order_id":"4101"}'

Until a payment is detected the customer can switch to another coin, which gives a new quote. Once a transfer has been seen, the coin is fixed (409 payment_already_detected), so a quote can never change under money that is already on its way.

How a coin-priced invoice works

With currency set to an asset id the amount you send is the amount the customer pays, rounded up to the coin's own precision. There is nothing to choose, so the gateway assigns the address while it creates the invoice and the response already carries pay_asset, pay_amount and pay_address. Paying with any other coin is refused with asset_not_allowed. The current rate is still stored in rate, for your books only.

curl -X POST https://api.easyway.cash/v1/invoices \
  -H "Authorization: Bearer $EASYWAY_API_KEY" \
  -H "Idempotency-Key: topup-4102" \
  -H "Content-Type: application/json" \
  -d '{"amount":"250","currency":"USDT_TRC20","order_id":"topup-4102"}'

An asset id is a coin plus its network: USDT on TRON is USDT_TRC20, a different balance from USDT on BNB Smart Chain or TON. The full list is in the Coins & networks table of the docs.

Which one to pick

SituationUse
A shop with prices in dollarsUSD, optionally with allowed_assets
Topping up a balance that you keep in USDTThe USDT asset id, e.g. USDT_TRC20
A price agreed in crypto ("0.01 BTC")The coin's asset id, e.g. BTC
You want to show the address in your own appA coin price, or USD with one id in allowed_assets

Either way the payment is credited in the coin that arrived, and easyway takes a flat 0.5% of it. A USD invoice paid in a volatile coin protects the quote, not your balance: once credited, the coin's later price moves are yours. If that is a concern, see avoiding volatility with stablecoin payments or narrow the checkout with allowed_assets.

Errors you may see

RequestResult
A currency that is not USD or an asset id, e.g. "EUR"400 validation_error
A USD amount above 1,000,000400 amount_too_large
A coin price whose coin is not in your allowed_assets400 asset_not_allowed
No fresh market price for the chosen coin (live mode)503 rate_unavailable

A customer who sends less than the quoted amount, or pays after expires_at, is covered in the underpaid and late payments guide. Try both kinds of invoice with an sk_test_ key first; the sandbox guide shows how.

Create free accountRead the API docsAlready have an account? Sign in
Price a crypto invoice in USD or in the coin | easyway