Skip to content

Geo Location

Overview

You can include geolocation information in transactions using the X-Geo-Location header in JSON format. By default, we determine location from the client’s IP address using MaxMind GeoIP. If you provide this header with valid data, it will be used instead of IP-based lookup.

Header structure

Pass a JSON object with the following fields:

FieldTypeDescription
latnumberLatitude coordinate
lngnumberLongitude coordinate
countrystringCountry name or code
citystringCity name
ipstring(Optional) Client IP address. If omitted, we use the request’s IP

Example

{
"lat": 42.3601,
"lng": -71.0589,
"country": "US",
"city": "Boston"
}

Behavior

  • If the header is present and contains valid JSON, the provided geo data is used
  • If the header is missing or contains invalid JSON, we fall back to IP-based geolocation
  • If ip is not provided in the header, the client’s request IP is automatically added