-
Notifications
You must be signed in to change notification settings - Fork 0
Currency Sources
WoompaLoompa edited this page Jul 21, 2026
·
2 revisions
Guide to exchange rate providers for fiat-to-satoshi conversion.
The plugin converts fiat prices (USD, EUR, etc.) to Bitcoin satoshis using exchange rate APIs.
Best for: Most merchants
| Property | Value |
|---|---|
| API Key Required | No |
| Rate Limit | 10-50 requests/minute |
| Update Frequency | 5 minutes (cached) |
| Currencies | 50+ |
| Cost | Free |
Configuration:
{
currencySource: "coingecko"
}Pros:
- No setup required
- Wide currency support
- Reliable
Cons:
- Rate limits on high traffic
- Slightly delayed rates
Best for: High-volume stores
| Property | Value |
|---|---|
| API Key Required | Optional |
| Rate Limit | 15 requests/minute |
| Update Frequency | 5 minutes (cached) |
| Currencies | 20+ |
| Cost | Free (higher limits with key) |
Configuration:
{
currencySource: "kraken"
}Pros:
- More accurate rates
- Professional exchange
- Higher limits with API key
Cons:
- Fewer currencies
- API key recommended for production
Best for: Stable pricing
| Property | Value |
|---|---|
| API Key Required | No |
| Rate Limit | None |
| Update Frequency | Manual |
| Currencies | 1 (set by you) |
| Cost | Free |
Configuration:
{
currencySource: "fixed",
fixedBtcRate: 65000 // 1 BTC = 65,000 USD
}Pros:
- Predictable pricing
- No API calls
- Stable for customers
Cons:
- Manual updates needed
- Can become outdated
Use Cases:
- Products with fixed BTC prices
- Promotional pricing
- Stablecoins integration
Best for: Direct satoshi pricing
| Property | Value |
|---|---|
| API Key Required | No |
| Rate Limit | None |
| Update Frequency | N/A |
| Currencies | N/A |
| Cost | Free |
Configuration:
{
currencySource: "manual"
}How it works:
- Enter prices directly in satoshis
- No conversion needed
- Customer sees sats amount
Use Cases:
- Bitcoin-native stores
- Micropayments
- Fixed sats pricing
| Feature | CoinGecko | Kraken | Fixed | Manual |
|---|---|---|---|---|
| Setup Required | No | Optional | Yes | No |
| Real-time Rates | Yes | Yes | No | N/A |
| Cost | Free | Free | Free | Free |
| Accuracy | Good | Best | Manual | Exact |
| Maintenance | None | None | High | None |
| Best For | Most | High-volume | Stable | BTC-native |
All sources use a 5-minute cache:
// Cache behavior
- First request: Fetches from API
- Next 5 minutes: Uses cached rate
- After 5 minutes: Fetches fresh rateProgrammatically clear the cache:
// In your custom code
currencyService.clearCache()const status = currencyService.getCacheStatus()
// { "usd": { rate: 66165, age: 120000 } }If the exchange rate API fails:
-
CoinGecko down
- Falls back to cache (if available)
- Throws error if no cache
-
Kraken down
- Falls back to cache
- Throws error if no cache
-
Fixed rate
- No API calls
- Always succeeds
| Source | Limit | Handling |
|---|---|---|
| CoinGecko | 10-50/min | Caching reduces calls |
| Kraken | 15/min | Caching reduces calls |
| Fixed | None | No API calls |
| Manual | None | No API calls |
-
Use CoinGecko or Kraken
- Reliable, well-maintained
- Good for most stores
-
Enable caching
- Default 5-minute cache is good
- Reduces API calls
-
Monitor usage
- Check logs for API errors
- Consider Kraken API key for high traffic
-
Consider Kraken with API key
- Higher rate limits
- More accurate
-
Increase cache TTL
- Modify
CACHE_TTLin utils.ts - Trade freshness for reliability
- Modify
-
Use fixed rate as fallback
- Set during high-traffic events
- Prevents API failures
Need a different exchange? The architecture supports adding new sources:
- Edit
src/modules/clink/utils.ts - Add new case in
getRate()method - Implement fetch logic
- Add tests
- Configuration - All options
- Troubleshooting - Common issues
- Contributing - Add new sources