Making Order
The authenticated user can make single order at EasyParcel. User need to make sure the courier service is available.
POST
https://demo.connect.easyparcel.sg/?ac=EPSubmitOrderBulk Body: application/x-www-form-urlencoded · action EPSubmitOrderBulk
Request parameters
Request L1
| Parameter | Type | Required | Description |
|---|---|---|---|
api | string(25) | Yes | Obtain from registered account. |
bulk | array | Yes | (Refer to Request L2) |
idempotency_ | string(255) | No | refer to https://easyparcel.github.io/nextgen-integration-doc/NextGenSwitches/idempotency_key |
Request L2 · bulk[]
| Parameter | Type | Required | Description |
|---|---|---|---|
weight | double(8,2) | Yes | The weight of the parcel. |
width | double(8,2) | Optional | The width of the parcel. |
length | double(8,2) | Optional | The length of the parcel. |
height | double(8,2) | Optional | The height of the parcel. |
content | string(35) | Yes | The content of the parcel. |
value | double(8,2) | Yes | The amount of the items. |
service_ | string(10) | Yes | Obtain from EPRateChecking return value. |
pick_ | string(35) | Yes | Sender's name |
pick_ | string(30) | Optional | Sender's company |
pick_ | string(16) | Optional | Sender's mobile. |
pick_ | string(16) | Yes | Sender's contact. |
pick_ | string(10) | Yes | Sender's unit |
pick_ | string(10) | Yes | Sender's postcode. |
pick_ | string(35) | Yes | Sender's country (“SG”). |
send_ | string(35) | Yes | Receiver's name. |
send_ | string(30) | Optional | Receiver's company. |
send_ | string(16) | Optional | Receiver's mobile. |
send_ | string(16) | Yes | Receiver's contact. |
send_ | string(10) | Yes | Receiver's unit |
send_ | string(35) | Yes | Receiver's addr1 |
send_ | string(10) | Yes | Receiver's state |
send_ | string(10) | Yes | Receiver's postcode. |
send_ | string(35) | Yes | Receiver's country. (Refer to Appendix II) |
collect_ | date | Yes | Check the available pickup date. If didn't put the date,today date will be default. Format : “YYYY-MM-DD” |
reference | string(25) | Optional | The parcel reference |
sms | boolean | Yes | Require for sms feature (Example, true/false) |
addon_ | boolean | Optional | The parcel is to whether purchase WhatsApp tracking. The receiver phone must be valid for the WhatsApp tracking to be received |
send_ | string(50) | Optional | Personal customs clearance code of south korea receiver (Only required for TracX Logis International) |
eori_ | boolean | Optional | For EasyParcel Business accounts, shipments to Europe require a valid EORI number to be configured in the Business Profile. Set this to true to acknowledge the risk and proceed with order submission without an EORI number provided |
Sample code
php
<?php
$domain = "https://demo.connect.easyparcel.sg/?ac=";
$action = "EPSubmitOrderBulk";
$postparam = array(
'api' => 'xxxxxx',
'bulk' => array(
array(
'weight' => '1',
'width' => '0',
'length' => '0',
'height' => '0',
'content' => 'book',
'value' => '20',
'service_id' => 'EP-CS0D',
'pick_name' => 'Yong Tat',
'pick_company' => 'Yong Tat Sdn Bhd',
'pick_mobile' => '',
'pick_contact' => '+6568505280',
'pick_unit' => '30',
'pick_code' => '059892',
'pick_country' => 'SG',
'send_name' => 'Sam',
'send_company' => '',
'send_mobile' => '',
'send_contact' => '+60-0178320239',
'send_unit' => '12',
'send_addr1' => '12',
'send_state' => 'png',
'send_code' => '119916',
'send_country' => 'SG',
'collect_date' => '2017-11-15',
'reference' => 'order123',
),
array(
'weight' => '1',
'width' => '0',
'length' => '0',
'height' => '0',
'content' => 'book',
'value' => '20',
'service_id' => 'EP-CS0D',
'pick_name' => 'Yong Tat',
'pick_company' => 'Yong Tat Sdn Bhd',
'pick_mobile' => '',
'pick_contact' => '+6568505280',
'pick_unit' => '30',
'pick_code' => '059892',
'pick_country' => 'SG',
'send_name' => 'Sam',
'send_company' => '',
'send_mobile' => '',
'send_contact' => '+60-0178320239',
'send_unit' => '12',
'send_addr1' => '12',
'send_state' => 'png',
'send_code' => '119916',
'send_country' => 'SG',
'collect_date' => '2017-11-15',
'reference' => 'order123',
),
),
);
$url = $domain.$action;
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($postparam));
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
ob_start();
$return = curl_exec($ch);
ob_end_clean();
curl_close($ch);
$json = json_decode($return);
echo "<pre>"; print_r($json); echo "</pre>";
?>bash
curl -X POST 'https://demo.connect.easyparcel.sg/?ac=EPSubmitOrderBulk' \
--data-urlencode 'api=xxxxxx' \
--data-urlencode 'bulk[0][weight]=1' \
--data-urlencode 'bulk[0][width]=0' \
--data-urlencode 'bulk[0][length]=0' \
--data-urlencode 'bulk[0][height]=0' \
--data-urlencode 'bulk[0][content]=book' \
--data-urlencode 'bulk[0][value]=20' \
--data-urlencode 'bulk[0][service_id]=EP-CS0D' \
--data-urlencode 'bulk[0][pick_name]=Yong Tat' \
--data-urlencode 'bulk[0][pick_company]=Yong Tat Sdn Bhd' \
--data-urlencode 'bulk[0][pick_mobile]=' \
--data-urlencode 'bulk[0][pick_contact]=+6568505280' \
--data-urlencode 'bulk[0][pick_unit]=30' \
--data-urlencode 'bulk[0][pick_code]=059892' \
--data-urlencode 'bulk[0][pick_country]=SG' \
--data-urlencode 'bulk[0][send_name]=Sam' \
--data-urlencode 'bulk[0][send_company]=' \
--data-urlencode 'bulk[0][send_mobile]=' \
--data-urlencode 'bulk[0][send_contact]=+60-0178320239' \
--data-urlencode 'bulk[0][send_unit]=12' \
--data-urlencode 'bulk[0][send_addr1]=12' \
--data-urlencode 'bulk[0][send_state]=png' \
--data-urlencode 'bulk[0][send_code]=119916' \
--data-urlencode 'bulk[0][send_country]=SG' \
--data-urlencode 'bulk[0][collect_date]=2017-11-15' \
--data-urlencode 'bulk[0][reference]=order123' \
--data-urlencode 'bulk[1][weight]=1' \
--data-urlencode 'bulk[1][width]=0' \
--data-urlencode 'bulk[1][length]=0' \
--data-urlencode 'bulk[1][height]=0' \
--data-urlencode 'bulk[1][content]=book' \
--data-urlencode 'bulk[1][value]=20' \
--data-urlencode 'bulk[1][service_id]=EP-CS0D' \
--data-urlencode 'bulk[1][pick_name]=Yong Tat' \
--data-urlencode 'bulk[1][pick_company]=Yong Tat Sdn Bhd' \
--data-urlencode 'bulk[1][pick_mobile]=' \
--data-urlencode 'bulk[1][pick_contact]=+6568505280' \
--data-urlencode 'bulk[1][pick_unit]=30' \
--data-urlencode 'bulk[1][pick_code]=059892' \
--data-urlencode 'bulk[1][pick_country]=SG' \
--data-urlencode 'bulk[1][send_name]=Sam' \
--data-urlencode 'bulk[1][send_company]=' \
--data-urlencode 'bulk[1][send_mobile]=' \
--data-urlencode 'bulk[1][send_contact]=+60-0178320239' \
--data-urlencode 'bulk[1][send_unit]=12' \
--data-urlencode 'bulk[1][send_addr1]=12' \
--data-urlencode 'bulk[1][send_state]=png' \
--data-urlencode 'bulk[1][send_code]=119916' \
--data-urlencode 'bulk[1][send_country]=SG' \
--data-urlencode 'bulk[1][collect_date]=2017-11-15' \
--data-urlencode 'bulk[1][reference]=order123'Response
Response L1
| Field | Type | Description | Remarks |
|---|---|---|---|
api_ | string(10) | Validation result | (Refer to Appendix I) |
error_ | int(5) | Error code | (Refer to Appendix I) |
error_ | string(100) | Error message | (Refer to Appendix I) |
result | array | The response of the orders made. | (Refer to Response L2) |
Response L2 · result
| Field | Type | Description | Remarks |
|---|---|---|---|
status | string(10) | The status of the orders made. | Fail / Success |
remarks | string(100) | The error message for orders made. | |
order_ | string(12) | The response of the order placed. | Failed = 0 / Success = (order_number) |
price | double(8,2) | Order price | |
addon_ | double(8,2) | The WhatsApp Tracking Charges Only |
Response samples
json
{
"api_status":"Success",
"error_code":"0",
"error_remark":"",
"result":[
{
"status":"Success",
"remarks":"Order Successfully Placed",
"order_number":"EI-000JC",
"price":"6.30"
},
{
"status":"Success",
"remarks":"Order Successfully Placed",
"order_number":"EI-000J3",
"price":"6.30"
}
]
}json
{
"api_status":"Error",
"error_code":"3",
"error_remark":"Required api key",
"result":[
]
}