Place an order with the PassAPI
Once you calculated the price of your order, you can use this endpoint in order to create a new order.
HTTP Request
https://api.pass.qa/business/v1/orders
Sample Request
<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.pass.qa/business/v1/orders",
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,
"addresses"=> [
"pickup" =>[
"lat"=> "25.275047",
"long"=> "51.535141",
"name"=> "majva",
"phone"=> "+97466661234",
"address"=> "this street",
"description"=> "it is a sample description"
],
"dropoffs" => [
[
"lat"=> "25.277007",
"long"=> "51.530034",
"name"=> "majva",
"phone"=> "+97466661234",
"address"=> "that street",
"description"=> "it is a sample description"
],
[
"lat"=> "25.277007",
"long"=> "51.530034",
"name"=> "majva",
"phone"=> "+97466661234",
"address"=> "other street",
"description"=> "it is a sample description"
],
[
"lat"=> "25.277007",
"long"=> "51.530034",
"name"=> "majva",
"phone"=> "+97466661234",
"address"=> "another street",
"description"=> "it is a sample description"
]
]
]
]
),
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',
headers:
{ Accept: 'application/json',
Authorization: 'Bearer '+token,
'Content-Type': 'application/json' },
body:
{
"pickup_id": 9,
"vehicle_id": 1,
"addresses": {
"pickup" :{
"lat": "25.275047",
"long": "51.535141",
"name": "majva",
"phone": "+97466661234",
"address": "this street",
"description": "it is a sample description"
},
"dropoffs" : [
{
"lat": "25.277007",
"long": "51.530034",
"name": "majva",
"phone": "+97466661234",
"address": "that street",
"description": "it is a sample description"
},
{
"lat": "25.277007",
"long": "51.530034",
"name": "majva",
"phone": "+97466661234",
"address": "other street",
"description": "it is a sample description"
},
{
"lat": "25.277007",
"long": "51.530034",
"name": "majva",
"phone": "+97466661234",
"address": "an other street",
"description": "it is a sample description"
}
]
}
},
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,
"addresses": {
"pickup" :{
"lat": "25.275047",
"long": "51.535141",
"name": "majva",
"phone": "+97466661234",
"address": "this street",
"description": "it is a sample description"
},
"dropoffs" : [
{
"lat": "25.277007",
"long": "51.530034",
"name": "majva",
"phone": "+97466661234",
"address": "that street",
"description": "it is a sample description"
},
{
"lat": "25.277007",
"long": "51.530034",
"name": "majva",
"phone": "+97466661234",
"address": "other street",
"description": "it is a sample description"
},
{
"lat": "25.277007",
"long": "51.530034",
"name": "majva",
"phone": "+97466661234",
"address": "an other street",
"description": "it is a sample description"
}
]
}
}
response = requests.post(baseUrl+'/v1/orders',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) |
addresses[pickup][lat] | null | true | numeric,between:-90,90 |
addresses[pickup][long] | null | true | numeric,between:-180,180. |
addresses[pickup][name] | null | true | string,max:100 |
addresses[pickup][phone] | null | true | International phone format |
addresses[pickup][address] | null | true | string,max:150 |
addresses[pickup][description] | null | false | string,max:150 |
addresses[dropoffs][0][lat] | null | true | numeric,between:-90,90 |
addresses[dropoffs][0][long] | null | true | numeric,between:-180,180. |
addresses[dropoffs][0][name] | null | true | string,max:100 |
addresses[dropoffs][0][phone] | null | true | International phone format |
addresses[dropoffs][0][address] | null | true | string,max:150 |
addresses[dropoffs][0][description] | null | false | string,max:150 |
addresses[dropoffs][1][lat] | null | false | numeric,between:-90,90 |
addresses[dropoffs][1][long] | null | false | numeric,between:-180,180. |
addresses[dropoffs][1][name] | null | false | string,max:100 |
addresses[dropoffs][1][phone] | null | false | International phone format |
addresses[dropoffs][1][address] | null | false | string,max:150 |
addresses[dropoffs][1][description] | null | false | string,max:150 |
addresses[dropoffs][2][lat] | null | false | numeric,between:-90,90 |
addresses[dropoffs][2][long] | null | false | numeric,between:-180,180. |
addresses[dropoffs][2][name] | null | false | string,max:100 |
addresses[dropoffs][2][phone] | null | false | International phone format |
addresses[dropoffs][2][address] | null | false | string,max:150 |
addresses[dropoffs][2][description] | null | false | string,max:150 |
payment_type | wallet | false | in: wallet, cash |
Response Descriptions
Attribute | Description |
---|---|
status | Indicates whether the submission progress has been successful or not. |
message | The message of the response |
order_id | The id of the created order. You can track your order by this id. |
{
"status": "success",
"http-code": 200,
"message": "Order placed successfully",
"data": {
"id": 36095,
"pickup": {
"lat": "25.275047",
"long": "51.535141",
"name": "majva",
"phone": "+97466661234",
"address": "this street",
"description": "it is a sample description"
},
"dropoffs": [
{
"task_id": "538514418",
"status": "Unassigned",
"type": "pickup",
"description": "",
"lat": "25.286193370207",
"lng": "51.51986517981",
"address": "8 شارع 948, الدوحة",
"receiver_name": "Prakash Menon",
"eta": "38min46sec"
},
{
"task_id": "538514419",
"status": "Unassigned",
"type": "dropoff",
"description": "TEST",
"lat": "25.678100974818",
"lng": "51.492313528809",
"address": "28 شارع 886, ازغوى, الريان",
"receiver_name": "al khor zone TEST ORDER",
"eta": "4min46sec"
},
{
"task_id": "538514420",
"status": "Unassigned",
"type": "dropoff",
"description": "TEST",
"lat": "25.335048",
"lng": "51.3023906",
"address": "الشيحانية, الريان",
"receiver_name": "Lehisiniya TEST ORDER",
"eta": "13min16sec"
}
],
"price": 25.97,
"date": "06/11/2024 13:42:30",
"payment_type": null,
"order_status": "Unassigned"
},
"option": {
}
}