Get Price Based on User Region

Use quoteCountryCode for region-specific pricing

The quoteCountryCode parameter allows you to get pricing and payment method availability based on a specific country, regardless of where the user is physically located. This is useful for showing accurate prices before the user enters the widget.

Why Use quoteCountryCode?

Use CaseDescription
Pre-display pricingShow users their local price before they open the widget
VPN/Proxy usersGet correct pricing for users connecting from different regions
Multi-country appsServe users across countries with localized pricing info
Backend price fetchingFetch quotes server-side for display in your own UI
Compliance pricingApply region-specific fees and limits correctly

Usage

texttext
// In widget URL
https://OZZOBiT.com/global?
  apiKey=YOUR_KEY
  &quoteCountryCode=GB
  &defaultCryptoCurrency=ETH
  &defaultFiatCurrency=GBP

// In API call (Whitelabel)
POST /api/v2/lookup/quote
{
  "partnerApiKey": "YOUR_KEY",
  "quoteCountryCode": "GB",
  "cryptoCurrency": "ETH",
  "fiatCurrency": "GBP",
  "fiatAmount": 100,
  "network": "ethereum"
}

// Response includes:
// - Available payment methods for GB
// - Correct fees and rates for GBP→ETH
// - KYC requirements for UK users
// - Transaction limits for the region

Detecting User Country

You can detect the user's country using IP geolocation services:

typescripttypescript
// Using a geolocation service
async function getUserCountry(): Promise<string> {
  try {
    const response = await fetch('https://ipapi.co/json/')
    const data = await response.json()
    return data.country_code // e.g., 'US', 'GB', 'DE'
  } catch {
    return 'US' // Fallback
  }
}

// Build widget URL with detected country
async function buildWidgetUrl(walletAddress: string) {
  const countryCode = await getUserCountry()
  
  const params = new URLSearchParams({
    apiKey: process.env.OZZOBiT_API_KEY!,
    walletAddress,
    quoteCountryCode: countryCode,
  })
  
  return `https://OZZOBiT.com/global?${params.toString()}`
}
ℹ️
Country Code Format

Use ISO 3166-1 alpha-2 country codes (2-letter): US, GB, DE, FR, JP, IN, BR, etc.

Supported Countries

OZZOBiT supports quoteCountryCode for all 150+ supported countries. Use our Countries API to fetch the full list of supported regions and their features.

Example: Pre-Fetch Quote

typescripttypescript
// Fetch quote before user opens widget
async function preFetchQuote(country: string) {
  const response = await fetch(
    'https://OZZOBiT.com/api/api/v2/lookup/quote',
    {
      method: 'POST',
      headers: { 'Content-Type': 'application/json' },
      body: JSON.stringify({
        partnerApiKey: 'YOUR_PUBLIC_KEY',
        quoteCountryCode: country,
        cryptoCurrency: 'ETH',
        fiatCurrency: 'USD',
        fiatAmount: 100,
        network: 'ethereum',
      }),
    }
  )
  
  const quote = await response.json()
  
  // Display to user:
  console.log(`Price: $100 = ${quote.cryptoAmount} ETH`)
  console.log(`Fee: ${quote.fee} (${quote.feePercentage}%)`)
  console.log(`Payment methods: ${quote.paymentMethods.map(m => m.id).join(', ')}`)
  
  return quote
}