- Handle gift cards with recipient information and delivery scheduling.
- Use geographic coordinates for location-aware services, such as local-inventory checking and delivery-radius validation.
Note: You can view the complete protocol reference for the Cart API and the Complete Checkout API.
Advanced use cases
Beyond basic cart operations, the API supports sophisticated scenarios like gift cards and location-based services. These examples demonstrate advanced integration capabilities.Gift cards
Create a cart containing a gift card with recipient details and scheduled delivery.Geographic coordinates
Some merchants offer location-based services that require precise geographic positioning beyond standard postal addresses. The Cart API supports optional latitude/longitude coordinates to enable features like local inventory checking, distance-based pricing, delivery radius validation, and enhanced shipping calculations. This geographic data operates independently from shipping addresses, allowing you to provide location-aware commerce experiences while maintaining clean separation between postal and coordinate data.Latitude and longitude support strategy
Geographic coordinates are optional. This feature is for merchants who can provide enhanced location services. Geographic coordinates are provided in a separategeo_coordinates field, distinct from the shipping_address object. This clean separation allows:
- Postal addresses to remain focused on standard shipping data
- Geographic coordinates to provide precise location enhancement
- Independent handling of address vs. coordinate data
- Graceful degradation when coordinates aren’t supported
Geographic fields
| Field | Description | Example |
|---|---|---|
latitude & longitude | Precise WGS84 coordinates in decimal degrees | latitude: "37.3349", longitude: "-122.0090" |
subdivision | Administrative division (state, province, region) using ISO 3166-2 format | subdivision: "CA" (California) |
country_code | ISO 3166-1 alpha-2 country code for the coordinate location | country_code: "US" |