Request to calculate your delivery rate
Request a quote to receive your exact delivery fee for an order by using the origin address and destination addresses.
This endpoint retrieves calculation information in the format of for a pair of {latitude, longitude} coordinates.
HTTP Request
https://api.pass.qa/business/v1/orders/price/calc
Sample Request
<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.pass.qa/business/v1/orders/price/calc",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode(
[
"pickup_id": 9,
"pickup" =>[
"lat" =>"25.275047",
"long" => "51.535141"
],
"dropoffs" => [
[
"lat" =>"25.277007",
"long" => "51.530034"
],
[
"lat" =>"25.277005",
"long" => "51.530039"
],
[
"lat" =>"25.277001",
"long" => "51.530030"
]
]
]
),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer ". $token,//$token is your token created in dashboard.
"Content-Type: application/json; charset=utf-8",
"Accept: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo 'cURL Error #:' . $err;
} else {
echo $response;
}
var request = require("request");
var token = 'mytokenvalue' //token value to be placed here;
var baseURL = 'https://api.pass.qa/business';
var options = { method: 'POST',
url: baseURL+'/v1/orders/price/calc',
headers:
{ Accept: 'application/json',
Authorization: 'Bearer '+token,
'Content-Type': 'application/json' },
body:
{
"pickup_id": 9,
"vehicle_id": 1,
"pickup" :{
"lat" :"25.275047",
"long" : "51.535141"
},
"dropoffs" : [
{
"lat" :"25.277007",
"long" : "51.530034"
},
{
"lat" :"25.277005",
"long" : "51.530039"
},
{
"lat" :"25.277001",
"long" : "51.530030"
}
]
},
json: true };
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
import requests
token = 'your token'
baseUrl ='https://api.pass.qa/business'
headers = {'Authorization': 'Bearer '+token,'Accept':'application/json','Content-Type':'application/json'}
data = {
"pickup_id": 9,
"vehicle_id": 1,
"pickup" :{
"lat" :"25.275047",
"long" : "51.535141"
},
"dropoffs" : [
{
"lat" :"25.277007",
"long" : "51.530034"
},
{
"lat" :"25.277005",
"long" : "51.530039"
},
{
"lat" :"25.277001",
"long" : "51.530030"
}
]
}
response = requests.post(baseUrl+'/v1/orders/price/calc',json=data, headers=headers)
print(response.json())
Request Parameters
Parameter | Default | Required | Description |
---|---|---|---|
pickup_id | null | false | numeric (can get pickup_id using getPickups api) |
pickup[lat] | null | true | numeric,between:-90,90 |
pickup[long] | null | true | numeric,between:-180,180. |
dropoffs[0][lat] | null | true | numeric,between:-90,90 |
dropoffs[0][long] | null | true | numeric,between:-180,180. |
dropoffs[1][lat] | null | false | numeric,between:-90,90 |
dropoffs[1][long] | null | false | numeric,between:-180,180. |
dropoffs[2][lat] | null | false | numeric,between:-90,90 |
dropoffs[2][long] | null | false | numeric,between:-180,180. |
Response Descriptions
Attribute | Description |
---|---|
status | Indicates whether the calculation progress has been successful or not. |
price | Total calculated price of the delivery. |
symbol | The symbol of currency. We only support QAR at the moment. |
{
"status": "success",
"message": "successful",
"data": {
"price": 11.04,
"symbol": "QAR"
}
}