There are three types of delivery zones. A merchant may have multiple delivery zones, each with it’s own fee.

Zone Type Description
Zip Code A single zip code
Radius A specific distance from the merchant’s location
Polygon A polygon of lat/long coordinates

A sample create call:

POST /merchant/admin/zones

{
	"merchantId"  : "1234",
	"deliveryZones"	: [
		{
			"fixedFee"	: 2,
			"polygon"	: [
				{
					"latitude"	: 40.728233,
					"longitude"	: -73.9841
				},
				{
					"latitude"	: 40.735779,
					"longitude"	: -74.002083
				},
				{
					"latitude"	: 40.748981,
					"longitude"	: -73.992638
				},
			],
			"orderMinimum"	: 5,
			"type"		: "polygon",
		},
		{
			"fixedFee"	: 2,
			"zipCode"	: "10038",
			"orderMinimum"	: 5,
			"type"		: "zipCode",
		},
		{
			"percentFee"	: 10,
			"radius"	: 3,
			"orderMinimum"	: 5,
			"type"		: "radius",
		},
	]
}
Property Name Value Description
merchantId integer The merchant that the delivery zone is for
deliveryZones DeliveryZone[] An array of DeliveryZone objects

A delivery zone object:

Property Name Value Description
id integer The id of the delivery zone
fixedFee float Required without percentFee – a flat dollar amount
percentFee float Required without fixedFee – a percent value on the order amount (can not be combined with fixedFee)
type radius|polygon|zipCode Required – the type of delivery zone
radius float Required if type is radius – distance in miles from the merchant
zipCode string Required if type is zipCode – a zip code the merchant delivers to
polygon array Required if type is polygon – a clockwise array of latitude/longitude coordinates

In the update PUT call, an id is required for each delivery zone:
PUT /merchant/admin/zones

{
	"merchantId"  : 1234,
	"deliveryZones"	: [
		{
			"fixedFee"	: 5,
			"id"		: 25357326,
			"polygon"	: [
				{
					"latitude"	: 40.728233,
					"longitude"	: -73.9841
				},
				{
					"latitude"	: 40.735779,
					"longitude"	: -74.002083
				},
				{
					"latitude"	: 40.748981,
					"longitude"	: -73.992638
				},
			],
			"orderMinimum"	: 5,
			"percentFee"	: 0,
			"type"		: "polygon",
		}
	]
}

A GET call expects the ‘merchantId’ parameter. A sample return:

GET /merchant/admin/zones?merchantId=1234

Response:

{
    "deliveryZones"	: [
		{
			"fixedFee"	: 1, //either fixedFee or percentFee will be populated, not both
			"id"		: 681,
			"polygon"	: [
				{
					"latitude"	: 40.728233,
					"longitude"	: -73.9841
				},
				{
					"latitude"	: 40.735779,
					"longitude"	: -74.002083
				},
				{
					"latitude"	: 40.748981,
					"longitude"	: -73.992638
				},
			],
			"orderMinimum"	: 5,
			"percentFee"	: 0,
			"type"		: "polygon", //indicates the field to look for, either polygon, zipCode, or radius
		}
	]
}

To delete delivery zones, include a comma separated list of ids:

DELETE /merchant/admin/zones?merchantId=1234&deliveryZoneIds=1,2,3

If you would prefer to simply delete all delivery zones, you may make a truncate call:

DELETE /merchant/admin/zones/truncate?merchantId=1234