Skip to main content

Single Order Create

The following request can be made to push a single order into our system

Request​

POST - {{url}}/api/public/merchant/order/single

Headers
{
"Accept": "application/json",
"Authorization": "Bearer {{ token }}",
"Content-Type": "application/json",
"X-tenant": "{{ tenant }}",
}
Sample Payload
{
"general_data": {
"merchant_business_id": "2",
"origin_city_name": "Aggona",
"origin_state_name": "Colombo Suburbs"
},
"order_data": [
{
"waybill_number":"AF3333533",
"order_no": "75757575",
"customer_name": "John Doe",
"customer_address": "Address line 1, Address line 2, Address line 3",
"customer_phone": "0794535345",
"customer_secondary_phone": "0792445546",
"destination_city_name": "Colombo 02",
"destination_state_name": "Colombo",
"cod": 4000,
"description": "Fragile item",
"weight": 3,
"remark": "please handle carefully"
}
]
}

Request Payload Objects​

general_data : required : Object - General Order details

  • merchant_business_id : required : String - Business ID of the merchant for which the order should be created
  • origin_city_id : optional : String - ID of the origin city of the order
  • origin_city_name : required_without_origin_city_id : String - Name of the origin city of the order
  • origin_state_name : required_without_origin_city_id : String - Name of the origin state of the order

order_data : required : Object - Order Specific Details

  • waybill_number : required_if_manual_waybill : String - Waybill number of the order
  • initial_status_key : optional | in_array: key_1, key_2 : String - Initial status key of the order. Defaults to key_1 if not specified
  • order_no : optional : String - Order number of the order
  • customer_name : required : String - Name of the customer to which the order should be delivered to
  • customer_address : required : String - Address of the customer to which the order should be delivered to
  • customer_phone : required : String - Contact number of the customer to which the order should be delivered to
  • customer_secondary_phone : optional : String - Users can input a secondary contact number specifically for delivery coordination if the staff admin has enabled this setting only
  • destination_city_id : optional : String - ID of the destination city of the order
  • destination_city_name : required_without_destination_city_id : String - Name of the destination city of the order
  • destination_state_name : required_without_destination_city_id : String - Name of the destination state of the order
  • cod : required : Integer - Amount which should be collected on delivery of the package to said customer
  • weight : required : Double - Approximate weight of the order package
  • description : optional : String - A short description of the order
  • remark : optional : String - Any remarks regarding the order

Response​

Status - 200 - OK

Sample Response Object
{
"message": "Orders Created Successfully",
"data": [
"AU145"
]
}

Response Payload Objects​

message : String - Success message once a order has been added
data : Object - A list of waybills for the newly created orders

ERRORS​

Invalid Bearer Token
{
"message": "Unauthenticated."
}
The merchant has no business with the provided business ID
{
"message": "The given data was invalid.",
"errors": {
"general_data.merchant_business_id": [
"The selected general data.merchant business id is invalid."
]
}
}
The entered waybill does not match the format required by the courier service provider
{
"message": "The given data was invalid.",
"errors": {
"errors": [
"This waybill CF000001, does not match the requested format"
]
}
}
Entered waybill already exists in our system
{
"message": "The given data was invalid.",
"errors": {
"order_data.0.waybill_number": [
"The order_data.0.waybill_number has already been taken."
]
}
}
Entered origin city ID does not exist in our system
{
"message": "The given data was invalid.",
"errors": {
"general_data.origin_city_id": [
"The selected general data.origin city id is invalid."
]
}
}
Entered origin city name does not exist in our system
{
"message": "The given data was invalid.",
"errors": {
"general_data.origin_city_name": [
"The selected general data.origin city name is invalid."
]
}
}
Entered origin state name does not exist in our system
{
"message": "The given data was invalid.",
"errors": {
"general_data.origin_state_name": [
"The selected general data.origin state name is invalid."
]
}
}
Entered destination city ID does not exist in our system
{
"message": "The given data was invalid.",
"errors": {
"order_data.0.destination_city_id": [
"The selected order_data.0.destination_city_id is invalid."
]
}
}
Entered destination city name does not exist in our system
{
"message": "The given data was invalid.",
"errors": {
"order_data.0.destination_city_name": [
"The selected order_data.0.destination_city_name is invalid."
]
}
}
Entered destination state name does not exist in our system
{
"message": "The given data was invalid.",
"errors": {
"order_data.0.destination_state_name": [
"The selected order_data.0.destination_state_name is invalid."
]
}
}
No rate card has been assigned to the merchant
{
"message": "The given data was invalid.",
"errors": {
"merchant_rate_card": [
"Please Assign a Rate Card for Merchant"
]
}
}
The rate card assigned to the merchant does not contain a requested city combination
{
"message": "The given data was invalid.",
"errors": {
"rate_card.destination_city_id": [
"There is no rate card assigned to you with the following city combination - Colombo 01 to Colombo 01!"
]
}
}