# Coins and amounts

> Coin codes and their precision, USDT on any network, dollar and ruble invoices, and the amount format in the PS Wallet Pay API.

In PS Wallet Pay, each coin is identified by a code, and amounts are passed as strings with a decimal point. This page covers which codes exist, how many decimal places they have, and how USDT without a specified network and fiat invoices work.

## Coin codes

| Code | Coin | Decimal places |
|---|---|---|
| `USDT-TRC20` | Tether on the TRON network | 6 |
| `USDT-BEP20` | Tether on the BNB Smart Chain network | 6 |
| `USDT-ERC20` | Tether on the Ethereum network | 6 |
| `USDT-TON` | Tether on the TON network | 6 |
| `XAUT` | Tether Gold (Ethereum) | 6 |
| `TRX` | TRON | 6 |
| `BNB` | BNB (BEP20) | 8 |
| `ETH` | Ethereum | 8 |
| `GRAM` | Gram (TON network) | 9 |
| `RUB` | Russian ruble | 2 |

In addition, there is the `USDT` code — USDT on any network (see below) — and the fiat currencies for the invoice price: `USD` and `RUB`, each with 2 decimal places.

> [!NOTE]
> The coins `TRX`, `BNB`, coins on the Ethereum network (`USDT-ERC20`, `XAUT`, `ETH`), and coins on the TON network (`USDT-TON`, `GRAM`) may be temporarily unavailable. The current list is returned by [getCurrencies](https://help.pswallet.org/en/pay-api/balance#getcurrencies), and an unavailable coin in the parameters causes the `PARAM_ASSET_INVALID` error.

## Where each code can be used

| Where | Allowed codes |
|---|---|
| `asset` in [createInvoice](https://help.pswallet.org/en/pay-api/invoices#createinvoice) | `USDT` or any coin code from the table. |
| `fiat` in createInvoice | `USD` or `RUB`. |
| `accepted_assets` in createInvoice | Coin codes and `USDT`, comma-separated. |
| `asset` in [transfer](https://help.pswallet.org/en/pay-api/transfers#transfer) and [createCheck](https://help.pswallet.org/en/pay-api/checks#createcheck) | `USDT` or any coin code from the table. |
| `asset` filter in `getTransfers` and `getChecks` | `USDT` (all networks) or a coin code. |
| API responses: `paid_asset`, `asset` of transfers and checks, `currency_code` of the balance | Always a code with the network (`USDT-TRC20`, `USDT-BEP20`, etc.), never `USDT`. |

The code is case-insensitive: `usdt-trc20` and `USDT-TRC20` are the same.

## USDT without a specified network

**In invoices** you can specify just `USDT`. The user will then be able to pay from any of their USDT accounts — TRC20, BEP20, ERC20, or TON — and the funds will arrive in the app balance on the network the user paid from. The payment network is indicated in the `paid_asset` field of the paid invoice.

If you need a specific network, specify its code, for example `USDT-TRC20`: the invoice can then be paid only from that account.

**In `transfer` and `createCheck`** the `USDT` code is also allowed: the funds are debited from the first network where the app balance has enough, in the order TRC20 → BEP20 → TON → ERC20. If no network has enough, the `INSUFFICIENT_FUNDS` error is returned. The recipient receives the funds on the same network — it is indicated in the `asset` field of the response.

## Invoices in dollars and rubles

An invoice can be issued in dollars (`USD`) or rubles (`RUB`): to do this, pass `currency_type=fiat` and `fiat`. The user chooses what to pay with from the allowed coins (`accepted_assets`). The amount due is recalculated at the exchange rate at the time of payment and rounded up to the smallest unit of the coin.

By default, a fiat invoice accepts `USDT`, `TRX`, `BNB`, `ETH`, `GRAM`, and `RUB` (of these, those that are currently available). `XAUT` is not on this list — to accept it, list the coins in `accepted_assets` explicitly.

The rates used to recalculate fiat invoices are returned by [getExchangeRates](https://help.pswallet.org/en/pay-api/balance#getexchangerates). The actual payment rate is saved in the invoice in the `paid_fiat_rate` and `paid_usd_rate` fields.

## Rubles

Currently, an invoice cannot be paid from a ruble account, and rubles cannot be sent to other users:

- `asset=RUB` in `createInvoice` returns the `PARAM_ASSET_INVALID` error;
- `RUB` in `accepted_assets` is ignored at payment, and if `RUB` is the only item in the list, the `PARAM_ACCEPTED_ASSETS_INVALID` error is returned;
- `asset=RUB` in `transfer` and `createCheck` returns the `403 TEMPORARILY_UNAVAILABLE` error.

However, the invoice price can be specified in rubles (`currency_type=fiat`, `fiat=RUB`) — the user will pay with another coin.

## Amount format

Amounts are passed and returned as strings with a decimal point: `"12.5"`, `"0.000001"`.

- In JSON you can also pass a number, but with no more decimal places than the coin has. For example, `12.5000001` for USDT (6 decimal places) causes the `PARAM_AMOUNT_INVALID` error; there is no rounding.
- The amount must be greater than zero, with no sign, spaces, or thousands separators, and no more than 15 digits before the decimal point.
- Trailing zeros are not counted as extra decimal places: `"12.500000000"` for USDT is `12.5`.
- In responses, extra zeros are dropped: `"12.5"`, not `"12.500000"`.

> [!TIP]
> Don't calculate money using the `float` type. Use exact-arithmetic libraries, for example `decimal.js` or `Big.js` in JavaScript and `decimal` in Python.

---
Source: https://help.pswallet.org/en/pay-api/assets
