On this page
The problem: prices do not wait
A customer places a $100 order and wants to pay in TRX. When the invoice is created, $100 equals a certain amount of TRX; by the time the customer opens a wallet and sends the payment, the TRX price may have moved a few percent. If it falls, the same TRX is no longer worth $100; if it rises, the customer overpays.
That uncertainty has two separate phases:
- Before payment: the rate moves while the invoice is open. The rate lock handles this.
- After payment: TRX sitting in your balance changes in value. That depends on your treasury decisions.
How the rate lock works
When you create a USD-priced invoice on HisarPay, no coin amount is fixed yet. The moment the customer picks TRX or USDT on the checkout, that coin’s current rate is locked and the amount due is calculated. From then on, the amount the customer sees does not change.
The lock gives the customer a reasonable window to pay. After a coin is chosen, the invoice always has at least 15 minutes left: if less time remains it is extended, and if more remains it is left alone. The window is never shortened. As long as nothing has been paid yet, the customer can switch coins, which locks the new coin’s rate instead.
An example timeline
| Time | Event | Result |
|---|---|---|
| 14:00 | A $100 invoice is created (valid for 60 min) | Expires 15:00, no coin amount yet |
| 14:50 | The customer picks TRX | Rate locked; only 10 min left, so expiry moves to 15:05 |
| 14:53 | The customer sends the payment | The payment is seen on-chain |
| 14:54 | 20 confirmations complete | The invoice is final as paid and the webhook is sent |
How the amount is calculated
USDT is pegged to the dollar, so it is priced 1:1: a $49.90 invoice comes to 50.90 USDT including the 1 USDT network fee. For TRX, the amount is calculated at the locked rate and rounded up, so rounding never works against you.
Payments that arrive after expiry
Sometimes a customer pays at the last second, or their exchange delays the withdrawal. On HisarPay a late payment is never lost: it is always credited to your balance and flagged with late: true. Whether a payment is late is judged by its block time, not by when our servers happened to see it.
The locked rate holds for the life of the invoice. Once that has passed, two rules apply:
- USD-priced TRX invoices are repriced at the current rate, so price movement after the lock expired is not pushed onto one side. The event’s
repricedfield shows the old and new amounts. - USDT invoices are not repriced, because USDT already tracks the dollar.
We cover every late, short and excess payment scenario in a separate guide.
Coin-priced invoices: skipping the rate entirely
Some businesses set prices directly in a coin, for example selling a digital product for 25 USDT. In that case you create the invoice with token and amount instead of price_usd. There is no dollar price to convert, so no rate lock or repricing applies.
Let the customer choose, or restrict the coin?
By default the customer chooses between TRX and USDT. Offering a choice lets customers who only hold one coin pay, which can lift conversion. On the other hand, every TRX payment carries price risk in your balance until you withdraw it.
| Approach | Upside | Watch out for |
|---|---|---|
| Customer chooses | More customers can pay | Your TRX balance moves with the market |
| USDT only | Removes most price risk | Customers who only hold TRX cannot pay |
| Price in a coin | No conversion needed | You have to keep prices up to date yourself |
Show prices in dollars on your site and say that the exact coin amount is calculated on the checkout when the customer picks a coin. That makes the link between the price in the cart and the amount on the checkout easy to follow.
Reducing exposure after payment
The rate lock solves the risk up to the moment of payment. TRX credited to your balance moves with the market until you withdraw or convert it. A few ways to manage that:
- Limit invoices to USDT. If you want no price exposure at all, accept only USDT through the
tokensfield. - Withdraw on a schedule. Move your TRX balance to your own wallet or exchange account at regular intervals.
- Turn on automatic withdrawals. Funds can be sent to a trusted address automatically once your balance reaches a threshold you choose. An address becomes trusted after it is at least 7 days old and has received at least 3 completed withdrawals.
- Pick the invoice lifetime deliberately. Lifetimes range from 5 minutes to 24 hours. Shorter windows mean less rate exposure, but less time for the customer.
const invoice = await hisarpay.invoices.create({
price_usd: '100.00',
tokens: ['USDT'], // accept USDT only
expires_in_minutes: 30, // 5–1440 minutes
order_id: 'ORD-2088',
});Frequently asked questions
When is the rate locked?
Can the customer switch coins?
What if a TRX payment arrives after the invoice expired?
Can I remove exchange-rate risk completely?
- #Rate lock
- #Volatility
- #Invoices
- #TRX
Try crypto payments in test mode
No setup or monthly fees. Experiment as much as you like in test mode and go live when you are ready.