Quotes & Exchange Rates
Quotes & Exchange Rates
Quotes provide exchange rate information and allow you to lock rates for a specific time period before creating orders.
What are Quotes?
A Quote is a request for exchange rate information that returns:
- Current exchange rate between currencies
- Fees (Koywe fee, network fee, partner fee)
- Expiration time (how long the rate is valid)
- Expected amounts (input and output)
Quote Time-to-Live (TTL)
Short Validity: Quotes are valid for 10-15 seconds only. After expiration, you must request a new quote. Always check the expiresAt or validFor field.
Why so short?
- Crypto and forex markets are volatile
- Ensures accurate, real-time pricing
- Protects against price manipulation
- Prevents stale rate usage
When to Use Quotes
Use quotes when:
- You need to show customers the exact amount theyโll receive
- Converting between currencies (BALANCE_TRANSFER)
- Buying or selling crypto (ONRAMP/OFFRAMP)
- You want rate transparency
Optional but Recommended: Quotes are optional for most order types but highly recommended for transparency and better user experience.
Creating a Quote
Basic Quote Request
Response:
Quote Response Fields
Using Quotes in Orders
Rate Locking
When you create an order with a quoteId, the exchange rate is locked:
Quote Expiration: Quotes are valid for a limited time (10-15 seconds). If the quote expires before you create the order, youโll need to get a new quote.
Quote Types by Order Type
PAYIN Quotes
For accepting payments (typically same currency, so rate = 1):
Response:
BALANCE_TRANSFER Quotes
For currency conversion:
Response:
ONRAMP Quotes
For buying crypto:
Network Required: ONRAMP quotes require a network parameter to specify the blockchain network for the crypto asset.
Supported networks:
ETHEREUM(for USDC, USDT, ETH)POLYGON(for USDC, USDT, MATIC)BSC(for USDC, USDT, BNB)BITCOIN(for BTC)TRON(for USDT)
Response:
OFFRAMP Quotes
For selling crypto:
Network Required: OFFRAMP quotes require a network parameter to specify the blockchain network for the crypto asset.
Response:
Understanding Fees
Fee Breakdown
Example calculation:
Fee Types
Showing Rates to Users
User-Friendly Display
Output:
Retrieving a Quote
Get details of an existing quote:
Best Practices
When to Get a Quote
Always get a quote for:
- Currency conversions (BALANCE_TRANSFER)
- Crypto operations (ONRAMP/OFFRAMP)
- Showing rate to users before they commit
Rate Display
Show users:
- Exchange rate in familiar terms (1 USD = X COP)
- Total fees clearly separated
- Effective rate (including fees)
- Expiration time
Handling Expiration
Quote vs No Quote
With Quote
Benefits:
- Rate locked
- User knows exactly what theyโll receive
- Better transparency
Without Quote
Considerations:
- Rate determined at order creation time
- Small rate fluctuation possible
- Faster (one less API call)