Customer country
Using the customer_country query parameter
In addition to the customer's IP address, you can provide the customer's country using the customer_country query parameter in the transaction and estimate requests.
Why use customer_country?
By default, Guardarian detects the customer's country from the customer's IP address, sent in the request body as customer.ip (or customer.ipV4 and customer.ipV6). If the customer_country query parameter is provided, it takes precedence over IP-based detection.
This gives the partner more control over geolocation-sensitive flows such as compliance checks, offer availability and checkout localization.
Requirements
- The
customer_countrymust be passed as a query parameter in the URL of the API request. - It should be provided as a 2-letter ISO 3166-1 alpha-2 country code (e.g.,
DE,FR,US).
Example: creating a transaction
POST /v1/transaction?customer_country=DE
Content-Type: application/json
{
"from_amount": 1200,
"from_currency": "EUR",
"to_currency": "BTC",
"from_network": "EUR",
"to_network": "BTC",
"customer": {
"ip": "203.0.113.42",
"contact_info": {
"email": "[email protected]"
}
}
}
Example: getting an estimate
GET /v1/estimate?from_currency=EUR&to_currency=BTC&from_amount=100&customer_country=US
Important notes
- The
X-Forwarded-Forheader and the ip query parameter are deprecated. They are only used when the request body has no customer IP, and support will be removed in a future version. Send the customer's IP in the request body instead. - The
customer_countrymust be passed in the query string, not in the body or headers. - If both a
customer.ipandcustomer_countryare present,customer_countryoverrides the IP-derived location. - DEPRECATED If both
X-Forwarded-Forandcustomer_countryare present,customer_countrywill override the IP-derived location. - This feature is only available if explicitly enabled for your account.
For more details on country-related configurations, please consult your Guardarian account manager.