Skip to main content

Price

1 API call in this section.

Get Delivery Price

Delivery & Last-Mile / Price
GET/delivery/price?delivery_service_id=uuid&pickup_lat=23.780&pickup_lng=90.410&dropoff_lat=23.810&dropoff_lng=90.430&units=1&language=en

Calculate delivery price based on pickup and dropoff coordinates and delivery service. Required Query Parameters: - delivery_service_id: UUID of the delivery service - pickup_lat: Pickup latitude - pickup_lng: Pickup longitude - dropoff_lat: Dropoff latitude - dropoff_lng: Dropoff longitude - units: Positive number of units for pricing Business Rules: - Price is calculated based on zones where pickup and dropoff coordinates fall - If pickup and dropoff are in the same zone, default price from delivery service may be used when zone pricing not found - If pickup and dropoff are in different zones, zone pricing rules are applied - Delivery service must exist and be active; units must be within service range

Send a bearer token in the Authorization header for an authenticated OnDi user session.
Request
curl
1curl --request GET "$ONDI_BASE_URL/delivery/price?delivery_service_id=uuid&pickup_lat=23.780&pickup_lng=90.410&dropoff_lat=23.810&dropoff_lng=90.430&units=1&language=en" \2  --header "Authorization: Bearer {{access_token}}"

Query parameters

delivery_service_idOptional
query string

uuid

UUID of the delivery service

pickup_latOptional
query string

23.780

Pickup latitude

pickup_lngOptional
query string

90.410

Pickup longitude

dropoff_latOptional
query string

23.810

Dropoff latitude

dropoff_lngOptional
query string

90.430

Dropoff longitude

unitsOptional
query string

1

Positive units for pricing

languageOptional
query string

en

Preferred language for response messages

Headers

AuthorizationOptional
header string

Bearer {{access_token}}

Responses

Success Response200OK
Response body
json
1{2  "price": 25.993}
Error - Location Not Found400Bad Request
Response body
json
1{2  "error": "Delivery location not found"3}
Error - Delivery Service Not Found400Bad Request
Response body
json
1{2  "error": "Delivery service not found"3}
Error - Internal Server Error500Internal Server Error
Response body
json
1{2  "success": false,3  "message": "Internal server error"4}