# Rate lock

> Fixing the fiat-to-crypto rate of a payment while the customer pays. When CryptoLike locks the rate, how long it holds and what rate_locked shows.

Source: https://cryptolike.net/glossary/rate-lock
Updated: 2026-10-09

Fixing the fiat-to-crypto exchange rate of an order at a set moment, so the crypto amount the customer must send does not change while they pay.

## How it works in CryptoLike

For a payment priced in fiat (`currency: "USD"`), CryptoLike locks the rate at the moment the asset is known: at creation when you pass `coin_id`, or when the payer chooses the asset on the checkout page (`POST /v1/checkout/{id}/coin`). The payment then carries `rate_locked` (the market quote: one coin = that many units of fiat), `rate_locked_at` and `amount_crypto` (the fiat amount at that rate, with no conversion spread, rounded up to the smallest unit of the coin), and the rate holds until `ttl_expires_at`. More: [pricing in USD, getting paid in crypto](https://cryptolike.net/blog/fiat-priced-crypto-payments).

Before the choice, the checkout page shows an approximate amount marked ≈ next to each coin, calculated the way a lock would be at that moment. An estimate is not a lock: the choice prices the payment again, and only then is the rate fixed. After that, the page shows the locked rate and the minutes it holds, next to the amount to send. If no fresh rate is available when the lock should happen, the request answers `503 unavailable`: retry, or create the payment in crypto. A payment priced in crypto has nothing to lock, so `rate_locked` stays `null`.

A locked rate is never recalculated. After the payment [expires](https://cryptolike.net/glossary/expired-payment), a new payment gets a new rate; funds that arrive late are credited by the actual crypto amount received. Payments priced in [stablecoins](https://cryptolike.net/glossary/stablecoin) avoid the conversion altogether when your prices are in US dollars.

## Example

A CryptoLike payment priced in US dollars with the asset fixed at creation: the rate is locked in the response, and `amount_crypto` is the exact amount the address expects. Leave `coin_id` out and the lock happens when the payer chooses the asset on the checkout page:

```json
{
  "amount": "49.90",
  "currency": "USD",
  "coin_id": "6f1c2a3e-8d4b-4c5a-9e7f-0a1b2c3d4e5f",
  "order_id": "10042"
}
```
