fencemaker
HomePricingUse CasesMigrate from RadarLive DemoQuickstartIntegrate with Android/iOS NEWPrompts for AI NEWMCP NEWDocsOperations Portal
Fencemaker API

Dynamic pricing by zone

Territory-to-metadata lookup. Check which pricing zone the address falls into, then apply the rate from your mapping.

1

Create Fencemaker account, get API key

Free tier covers 1,000 checks/day. For high-volume e-commerce, Growth plan handles 35,000/day.

2

Define one territory per pricing tier

Urban core ($3), suburbs ($6), extended range ($10). Store territory_id → pricing_rule in your DB.

3

On cart calculation: geocode → call /pip?multi=true

Returns matching territory objects. Look up the pricing metadata in your system keyed by territory_id.

4

Apply the delivery fee to cart total

Read territory id from the response to get the fee. Handle no-match scenarios with a fallback rate.

// At checkout: calculate zone-based delivery fee
const { lat, lon } = geocodedAddress;

const res = await fetch(
  `https://fencemaker.app/api/v1/pip?lat=${lat}&lon=${lon}&multi=true`,
  { headers: { 'X-API-Key': 'YOUR_KEY' } }
);
const data = await res.json();

// Pricing metadata stored in your DB (cents), keyed by territory_id
const pricingMap = {
  'uuid-urban':    300,   // $3 - city center
  'uuid-suburb':   600,   // $6 - suburbs
  'uuid-extended': 1000  // $10 - extended range
};

// Apply first matching zone or fallback rate
const deliveryFee = data.matched && data.territories.length > 0
  ? pricingMap[data.territories[0].id]
  : 1500; // $15 fallback for outside all zones

cart.deliveryFee = deliveryFee;
cart.total = cart.subtotal + deliveryFee;

Watch out:

Fencemaker stores territory geometry, not pricing rules. Store your metadata (fees, SLAs, restrictions) in your own database keyed by territory_id. The API tells you WHICH territory matched — you decide WHAT THAT MEANS for your business logic.