Individual
Rate Checking
This enable rate checking from all courier companies in EasyParcel platform. User need to provide sender and receiver address to check the shipment rate.
Request L1
Name | Type | Required | Description |
---|---|---|---|
api | string(25) | Yes | Obtain from registered account. |
bulk | array | Yes | (Refer to table L2) |
Request L2
Name | Type | Required | Description |
---|---|---|---|
pick_code | string(10) | Yes | Sender's postcode. |
pick_country | string(2) | Yes | Sender's country (“SG”). |
send_code | string(10) | Yes | Receiver's postcode. |
send_country | string(2) | Yes | Receiver's country (“SG”). |
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. |
date_coll | date | Optional | Check the available pickup date. If the date is left empty, the default will be today’s date. Format : “YYYY-MM-DD” |
parcel_value | double(8,2) | Optional | The value of parcel in SGD |
Sample Code
<?php
$domain = "https://demo.connect.easyparcel.sg/?ac=";
$action = "EPRateCheckingBulk";
$postparam = array(
'api' => 'xxxxxx',
'bulk' => array(
array(
'pick_code' => '059893',
'pick_country' => 'SG',
'send_code' => '059897',
'send_country' => 'SG',
'weight' => '10',
'width' => '0',
'length' => '0',
'height' => '0',
'date_coll' => '2017-11-10',
),
array(
'pick_code' => '059893',
'pick_country' => 'SG',
'send_code' => '059897',
'send_country' => 'SG',
'weight' => '10',
'width' => '0',
'length' => '0',
'height' => '0',
'date_coll' => '2017-11-10',
),
),
);
$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>";
?>
Response L1
Return Value | Type | Description | Remarks |
---|---|---|---|
api_status | string(10) | Validation result | (Refer to Appendix I) |
error_code | int(5) | Error code | (Refer to Appendix I) |
error_remark | string(100) | Error message | (Refer to Appendix I) |
result | array | The response of the rate checking | (Refer to table L2) |
Response L2
Return Value | Type | Description | Remarks |
---|---|---|---|
status | string(10) | The status of the rate checking. | Fail / Success |
remarks | string(100) | The error message for rate checking. | |
rates | array | The result of the rate checking | (Refer to table L3) |
Response L3
Return Value | Type | Description | Remarks |
---|---|---|---|
service_id | string (15) | Service ID | |
service_name | string (100) | Service name | |
service_type | string (10) | Type of service | parcel/ document |
courier_id | string (10) | Courier ID | |
courier_name | string (100) | Courier name | |
courier_logo | string (300) | Courier logo | |
scheduled_start_date | string (50) | Scheduled pickup for parcel. | |
pickup_date | date | The date to pickup the parcel. | Same day pickup only available before 12pm. |
delivery | string (100) | The day(s) to deliver the parcel. | |
price | double(8,2) | Booking price. | |
whatsapp_tracking_available | boolean | Identifies if there is whatsapp tracking service available | True if supported / False if not supported. Addon insurance can only be purchased for parcels which value exceed the basic_insurance_max_value. |
whatsapp_tracking_price | double(8,2) | Whatsapp Tracking charges/price | |
import_tax_charges | double(8,2) | DDP Tax Charges (For International Shipment) | |
import_duty_charges | double(8,2) | DDP Duty Charges (For International Shipment) | |
handling_charges | double(8,2) | DDP Handling Charges (For International Shipment) |
Response sample - Success
{
"api_status":"Success",
"error_code":"0",
"error_remark":"",
"result":[
{
"status":"Success",
"remarks":"",
"rates":[
{
"service_id":"EP-CS0D",
"service_name":"Next Day Pick Up Service",
"service_type":"parcel",
"courier_id":"EP-CR0A",
"courier_name":"Nationwide",
"courier_logo":"http:\/\/source.easyparcel.sg\/img\/logo\/Nationwide-Express-logo.jpg",
"scheduled_start_date":"2017-11-11 Saturday",
"pickup_date":"2017-11-11",
"delivery":"Estimated 1 working day(s)",
"price":"20.90"
}
]
},
{
"status":"Success",
"remarks":"",
"rates":[
{
"service_id":"EP-CS0D",
"service_name":"Next Day Pick Up Service",
"service_type":"parcel",
"courier_id":"EP-CR0A",
"courier_name":"Nationwide",
"courier_logo":"http:\/\/source.easyparcel.sg\/img\/logo\/Nationwide-Express-logo.jpg",
"scheduled_start_date":"2017-11-11 Saturday",
"pickup_date":"2017-11-11",
"delivery":"Estimated 1 working day(s)",
"price":"20.90"
}
]
}
]
}
Response example - Fail
{
"api_status":"Error",
"error_code":"3",
"error_remark":"Required api key",
"result":[
]
}
Making Order
The authenticated user can make single order at EasyParcel. User need to make sure the courier service is available.
Request L1
Name | Type | Required | Description |
---|---|---|---|
api | string(25) | Yes | Obtain from registered account. |
bulk | array | Yes | (Refer to Request L2) |
Request L2
Name | 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_id | string(10) | Yes | Obtain from EPRateChecking return value. |
pick_name | string(35) | Yes | Sender's name |
pick_company | string(30) | Optional | Sender's company |
pick_mobile | string(16) | Optional | Sender's mobile. |
pick_contact | string(16) | Yes | Sender's contact. |
pick_unit | string(10) | Yes | Sender's unit |
pick_code | string(10) | Yes | Sender's postcode. |
pick_country | string(35) | Yes | Sender's country (“SG”). |
send_name | string(35) | Yes | Receiver's name. |
send_company | string(30) | Optional | Receiver's company. |
send_mobile | string(16) | Optional | Receiver's mobile. |
send_contact | string(16) | Yes | Receiver's contact. |
send_unit | string(10) | Yes | Receiver's unit |
send_addr1 | string(35) | Yes | Receiver's addr1 |
send_state | string(10) | Yes | Receiver's state |
send_code | string(10) | Yes | Receiver's postcode. |
send_country | string(35) | Yes | Receiver's country. (Refer to Appendix II) |
collect_date | 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_whatsapp_tracking_enabled | boolean | Optional | The parcel is to whether purchase WhatsApp tracking. The receiver phone must be valid for the WhatsApp tracking to be received |
Sample Code
<?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>";
?>
Response L1
Return Value | Type | Description | Remarks |
---|---|---|---|
api_status | string(10) | Validation result | (Refer to Appendix I) |
error_code | int(5) | Error code | (Refer to Appendix I) |
error_remark | string(100) | Error message | (Refer to Appendix I) |
result | array | The response of the orders made. | (Refer to Response L2) |
Response L2
Return Value | Type | Description | Remarks |
---|---|---|---|
status | string(10) | The status of the orders made. | Fail / Success |
remarks | string(100) | The error message for orders made. | |
order_number | string(12) | The response of the order placed. | Failed = 0 / Success = (order_number) |
price | double(8,2) | Order price | |
addon_whatsapp_tracking_charges | double(8,2) | The WhatsApp Tracking Charges Only |
Response sample - Success
{
"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"
}
]
}
Response example - Fail
{
"api_status":"Error",
"error_code":"3",
"error_remark":"Required api key",
"result":[
]
}
Making Order Payment
This step involves payment for the orders made. The authenticated user can do single order payment. Single order payment refers to payment for a single parcel only. There are various payment conditions that may appear such as insufficient credit (when user’s account do not have sufficient credit to perfom payment), sufficient credit (when there are sufficient credit for payment) and etc.
Request L1
Name | Type | Required | Description |
---|---|---|---|
api | string(25) | Yes | Obtain from registered account. |
bulk | array | Yes | (Refer to Request L2) |
Request L2
Name | Type | Required | Description |
---|---|---|---|
order_no | string(15) | Yes | Acquire from the order that placed. |
Sample Code
<?php
$domain = "https://demo.connect.easyparcel.sg/?ac=";
$action = "EPPayOrderBulk";
$postparam = array(
'api' => 'xxxxxx',
'bulk' => array(
array(
'order_no' => 'EI-000JK',
),
array(
'order_no' => 'EI-000JK',
),
),
);
$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>";
?>
Response L1
Return Value | Type | Description | Remarks |
---|---|---|---|
api_status | string(10) | Validation result | (Refer to Appendix I) |
error_code | int(5) | Error code | (Refer to Appendix I) |
error_remark | string(100) | Error message | (Refer to Appendix I) |
result | array | The response of the make order payment | (Refer to Response L2) |
Response L2
Return Value | Type | Description | Remarks |
---|---|---|---|
orderno | string (15) | Valid order number. | Valid and authenticated. |
messagenow | string (50) | The message that shows the status of order. | |
parcel | array | The details of the parcel. | (Refer to Response L3) |
Response L3
Return Value | Type | Description | Remarks |
---|---|---|---|
parcelno | string (15) | Parcel number. | |
awb | string (45) | Airway bill number. | |
awb_id_link | string (300) | Link of airway bill ID. |
Response sample - Success
{
"api_status":"Success",
"error_code":"0",
"error_remark":"",
"result":[
{
"orderno":"EI-000JK",
"messagenow":"Fully paid",
"parcel":[
{
"parcelno":"EP-00016",
"awb":"86983174113435",
"awb_id_link":"http:\/\/demo.connect.easyparcel.sg\/?ac=AWBLabel&id=bFk1NHNBQ08jNDYx"
}
]
},
{
"orderno":"EI-000JK",
"messagenow":"Fully paid",
"parcel":[
{
"parcelno":"EP-00016",
"awb":"86983174113435",
"awb_id_link":"http:\/\/demo.connect.easyparcel.sg\/?ac=AWBLabel&id=bFk1NHNBQ08jNDYx"
}
]
}
]
}
Response example - Fail
{
"api_status":"Error",
"error_code":"3",
"error_remark":"Required api key",
"result":[
]
}
Checking Order Status
Get order status by using order number is the recommended call to use for management. Use this call to retrieve all orders in which the authenticated caller.
Request L1
Name | Type | Required | Description |
---|---|---|---|
api | string(25) | Yes | Obtain from registered account. |
bulk | array | Yes | (Refer to Request L2) |
Request L2
Name | Type | Required | Description |
---|---|---|---|
order_no | string(15) | Yes | Acquire from the order placed earlier. |
Sample Code
<?php
$domain = "https://demo.connect.easyparcel.sg/?ac=";
$action = "EPOrderStatusBulk";
$postparam = array(
'api' => 'xxxxxx',
'bulk' => array(
array(
'order_no' => 'EI-000JK',
),
array(
'order_no' => 'EI-000JK',
),
),
);
$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>";
?>
Response L1
Return Value | Type | Description | Remarks |
---|---|---|---|
api_status | string(10) | Validation result | (Refer to Response L2) |
error_code | int(5) | Error code | (Refer to Appendix I) |
error_remark | string(100) | Error message | (Refer to Appendix I) |
result | array | The result for order status, if status is Success | (Refer to Appendix I) |
Response L2
Return Value | Type | Description | Remarks |
---|---|---|---|
status | string(10) | The status of the orders made. | Fail / Success. |
remarks | string(100) | The message for orders made. | |
order_no | string(15) | Order number. | |
order_status | string(25) | The status of your order. | Cancel / Waiting Payment / Paid / Partial Payment / Undefined Status |
order_payable | string(10) | The order that can pay. | True / False |
Response sample - Success
{
"api_status":"Success",
"error_code":"0",
"error_remark":"",
"result":[
{
"status":"Success",
"remarks":"Correct Order_no",
"order_no":"EI-000JK",
"order_status":"Paid",
"order_payable":"False"
},
{
"status":"Success",
"remarks":"Correct Order_no",
"order_no":"EI-000JK",
"order_status":"Paid",
"order_payable":"False"
}
]
}
Response example - Fail
{
"api_status":"Error",
"error_code":"3",
"error_remark":"Required api key",
"result":[
]
}
Checking Parcel Status
Get parcel status by using order number is the recommended call to use for checking the shipment. Use this call to retrieve parcel details.
Request L1
Name | Type | Required | Description |
---|---|---|---|
api | string(25) | Yes | Obtain from registered account. |
bulk | array | Yes | (Refer to Request L2) |
Request L2
Name | Type | Required | Description |
---|---|---|---|
order_no | string(15) | Yes | Acquire from the order placed |
Sample Code
<?php
$domain = "https://demo.connect.easyparcel.sg/?ac=";
$action = "EPParcelStatusBulk";
$postparam = array(
'api' => 'xxxxxx',
'bulk' => array(
array(
'order_no' => 'EI-000JK',
),
array(
'order_no' => 'EI-000JK',
),
),
);
$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>";
?>
Response L1
Return Value | Type | Description | Remarks |
---|---|---|---|
api_status | string(10) | Validation result | (Refer to Appendix I) |
error_code | int(5) | Error code | (Refer to Appendix I) |
error_remark | string(100) | Error message | (Refer to Appendix I) |
result | array | The result for parcel status, if status is Success | (Refer to Response L2) |
Response L2
Return Value | Type | Description | Remarks |
---|---|---|---|
status | string(10) | The status of the orders made. | |
remarks | string(100) | The message for orders made. | |
order_no | string(15) | Order number. | |
parcel | array | The result for parcel status, if status is Success | (Refer to Response L3) |
Response L3
Return Value | Type | Description | Remarks |
---|---|---|---|
parcel_number | string(15) | The number of the parcel. | |
ship_status | string(45) | The status of the shipment. | Cancel / Waiting Payment / Pending For Collection / Collected / Returned / Delivering(in transit) / Successfully Delivered / Schedule In Arrangement / On Hold / Expired (Unpaid) / Cancel By Admin / Drop Off / Other Status |
awb | string(45) | Airway bill number. | Empty if null. |
awb_id_link | string(300) | The URL link of the Airway bill | Downloadable PDF file |
Response sample - Success
{
"api_status":"Success",
"error_code":"0",
"error_remark":"",
"result":[
{
"status":"Success",
"remarks":"Correct Order_no",
"order_no":"EI-000JK",
"parcel":[
{
"parcel_number":"EP-00016",
"ship_status":"Schedule In Arrangement",
"awb":"86983174113435",
"awb_id_link":"http:\/\/demo.connect.easyparcel.sg\/?ac=AWBLabel&id=bFk1NHNBQ08jNDYx"
}
]
},
{
"status":"Success",
"remarks":"Correct Order_no",
"order_no":"EI-000JK",
"parcel":[
{
"parcel_number":"EP-00016",
"ship_status":"Schedule In Arrangement",
"awb":"86983174113435",
"awb_id_link":"http:\/\/demo.connect.easyparcel.sg\/?ac=AWBLabel&id=bFk1NHNBQ08jNDYx"
}
]
}
]
}
Response example - Fail
{
"api_status":"Error",
"error_code":"3",
"error_remark":"Required api key",
"result":[
]
}
Tracking Parcel Details
Track the shipment status using airway bill number.
Request L1
Name | Type | Required | Description |
---|---|---|---|
api | string(25) | Yes | Obtain from registered account. |
bulk | array | Yes | (Refer to Request L2) |
Request L2
Name | Type | Required | Description |
---|---|---|---|
awb_no | string(25) | Yes | Generate automatically after the payment. |
Sample Code
<?php
$domain = "https://demo.connect.easyparcel.sg/?ac=";
$action = "EPTrackingBulk";
$postparam = array(
'api' => 'xxxxxx',
'bulk' => array(
array(
'awb_no' => '86983175113435',
),
array(
'awb_no' => '86983175113435',
),
),
);
$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>";
?>
Response L1
Return Value | Type | Description | Remarks |
---|---|---|---|
api_status | string(10) | Validation result | (Refer to Appendix I) |
error_code | int(5) | Error code | (Refer to Appendix I) |
error_remark | string(100) | Error message | (Refer to Appendix I) |
result | array | Result of tracking | (Refer to Response L2) |
Response L2
Return Value | Type | Description | Remarks |
---|---|---|---|
latest_status | string(45) | The status of the shipment. | (Refer to Response L3 & Response L4) |
latest_status | string(45) | The status of the shipment. | |
latest_update | string(45) | Show the date and time. | |
awb | string(45) | Airway bill number. |
Response L3
Return Value | Type | Description | Remarks |
---|---|---|---|
status | string(45) | The status of the shipment. | |
sender | string(45) | The name of the sender | |
receiver | string(45) | The name of the receiver |
Response L4
Return Value | Type | Description | Remarks |
---|---|---|---|
event_date | date | Show date. | |
event_time | time | Show time. | |
status | string(150) | The status of the shipment. | |
location | string(100) | Track the location of the parcel. |
Response sample - Success
{
"api_status":"Success",
"error_code":"0",
"error_remark":"",
"result":[
{
"status_list":{
"0":{
"event_date":"2017-12-27",
"event_time":"11:40 AM",
"status":"Delivered",
"location":"Demo"
},
"status":"",
"sender":"xxxxxx",
"receiver":"xxxxxx"
},
"latest_status":"Deliverd",
"latest_update":"2017-12-27",
"awb":"86983175113435"
},
{
"status_list":{
"0":{
"event_date":"2017-12-27",
"event_time":"11:40 AM",
"status":"Delivered",
"location":"Demo"
},
"status":"",
"sender":"xxxxxx",
"receiver":"xxxxxx"
},
"latest_status":"Deliverd",
"latest_update":"2017-12-27",
"awb":"86983175113435"
}
]
}
Response example - Fail
{
"api_status":"Error",
"error_code":"3",
"error_remark":"Required api key",
"result":[
]
}
Get Insurance Rate
This enables users to check the insurance rates from specific courier companies on the EasyParcel platform. Users are required to fill in the necessary fields to access the insurance rate information.
Request L1
Name | Type | Required | Description |
---|---|---|---|
api | string(25) | Yes | Obtain from a registered account. |
awb | string(100) | Yes | Tracking number of the parcel |
parcel_content_value | double(8,2) | Yes | Parcel pricing |
courier | string(25) | Yes | Shipment courier. (Refer to Appendix IV) |
coll_country | string(5) | Yes | Sender's country. (Refer to Appendix II) |
deli_country | string(5) | Yes | Receiver's country. (Refer to Appendix II) |
coll_state | string(25) | Yes | Sender's state. (Refer to Appendix III) |
deli_state | string(25) | No | Receiver’s state, if deli_courtery is MY , will be required |
Sample Code
<?php
$domain = "http://demo.connect.easyparcel.sg/?ac=";
$action = "EPInsuranceRateChecking";
$postparam = array(
'api' => 'xxxxxx',
'awb' => 'TestingAWB',
'parcel_content_value' => '390',
'courier' => 'EP-CR05',
'coll_country' => 'MY',
'deli_country' => 'MY',
'coll_state' => 'srw',
'deli_state' => 'srw',
);
$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>";
?>
Response L1
Return Value | Type | Description | Remarks |
---|---|---|---|
result | object | Result for rate checking | (Refer to Response L2) |
error_code | int(5) | Error Code | (Refer to Appendix I) |
error_remark | string(100) | Error Message | (Refer to Appendix I) |
error_detail | object | Error Details | |
status | string(10) | Get rate status is Success / Fail | |
api_status | string(10) | API Validation result | (Refer to Appendix I) |
Response L2
Return Value | Type | Description | Remarks |
---|---|---|---|
awb | string(25) | The Air Waybill (AWB) number. | |
courier | string(100) | The name of the courier. | |
parcel_content_value | double(8,2) | The declared value of the parcel content. | |
insurance_amount | double(8,2) | The quoted amount for insurance coverage. | |
parcel_delivery_type | string(100) | Type of parcel delivery | domestic / international. |
Response sample - Success
{
"result": {
"awb": "TestingAWB",
"courier": "Skynet",
"parcel_content_value": "390",
"insurance_amount": 9.75,
"parcel_delivery_type": "Domestic"
},
"status": "Success",
"error_code": 0,
"error_remark": "",
"error_detail": "",
"api_status": "Success"
}
Response example - Fail
{
"result":[
],
"status":"",
"error_code":"3",
"error_remark":"Required api key",
"api_status":"Error"
}
Purchase Insurance
This step involves both ordering and making payments for the orders placed. Authenticated users can make single insurance order payments. Single order payment specifically refers to the payment for a single parcel. Various payment conditions may arise, such as insufficient credit (when the user account lacks sufficient funds for payment) or sufficient credit (when there are adequate funds available for payment).
Request L1
Name | Type | Required | Description |
---|---|---|---|
api | string(25) | Yes | Obtain from a registered account. |
awb | string(25) | Yes | The Air Waybill (AWB) number. |
parcel_content_value | double(8,2) | Yes | The declared value of the parcel content. |
courier | string(25) | Yes | Shipment courier. (Refer to Appendix IV) |
coll_country | string(2) | Yes | The country code of the collection address, limited to 'MY' or 'SG'. |
deli_country | string(2) | Yes | Receiver country code.Refer to ISO 3166-2 |
coll_state | string(35) | Yes | Sender’s state. (Refer to Appendix III) |
deli_state | string(35) | Yes | Receiver state. |
parcel_category_id | int(2) | Yes | The parcel category id (Refer to Get Parcel Category API) |
parcel_content | string(35) | Yes | The content of the parcel. |
parcel_content_type | string(8) | Yes | The type of parcel content, limited to 'document' or 'parcel'. |
parcel_content_currency_code | string(3) | Yes | The currency code of the parcel content. |
parcel_content_weight | double(8,2) | Yes | The weight of the parcel content. |
coll_name | string(35) | Yes | Sender name. |
coll_company | string(35) | No | Sender company |
coll_mobile_code | string(2) | Yes | Sender mobile country mobile , eg: 60 |
coll_mobile | string(16) | Yes | Sender mobile number |
coll_alternative_mobile_code | string(2) | No | Sender alternative mobile country mobile , eg: 60 |
coll_alternative_mobile | string(16) | No | Sender alternative mobile number |
coll_email | string(35) | No | Sender email |
deli_name | string(35) | Yes | Receiver name. |
deli_company | string(35) | No | Receiver company name. |
deli_mobile_code | string(2) | Yes | Receiver mobile country mobile , eg: 60 |
deli_mobile | string(35) | Yes | Receiver mobile number. |
deli_alternative_mobile_code | string(2) | No | Receiver alternative mobile country mobile , eg: 60 |
deli_alternative_mobile | string(35) | No | Receiver alternative mobile number. |
deli_email | string(35) | No | Receiver email address. |
coll_address_1 | string(35) | Yes | Sender's address line 1. |
coll_address_2 | string(35) | No | Sender's address line 2. |
coll_postcode | string(10) | Yes | Sender's postcode. |
coll_city | string(35) | Yes | Sender city |
deli_address_1 | string(35) | Yes | Receiver address line 1. |
deli_address_2 | string(35) | No | Receiver address line 2. |
deli_postcode | string(10) | Yes | Receiver postcode. |
deli_city | string(35) | Yes | Receiver city.. |
shipment_date | date | Yes | The date of the shipment in the format YYYY-MM-DD. |
Sample Code
<?php
$domain = "http://demo.connect.easyparcel.sg/?ac=";
$action = "EPInsurancePurchase";
$postparam = array(
'api' => 'xxxxxx',
'awb' => 'TESTDomestic',
'parcel_content_value' => '250',
'courier' => 'EP-CR05',
'coll_country' => 'MY',
'deli_country' => 'MY',
'coll_state' => 'png',
'deli_state' => 'png',
'parcel_category_id' => '12',
'parcel_content' => 'testing',
'parcel_content_type' => 'parcel',
'parcel_content_currency_code' => 'MYR',
'parcel_content_weight' => '123',
'coll_name' => '12313',
'coll_company' => 'Testing Company',
'coll_mobile_code' => '60',
'coll_mobile' => '162631234',
'coll_alternative_mobile_code' => '60',
'coll_alternative_mobile' => '123456789',
'coll_email' => '[email protected]',
'deli_name' => 'Receiver Testing',
'deli_company' => 'Receiver Testing Company',
'deli_mobile_code' => '60',
'deli_mobile' => '123456789',
'deli_alternative_mobile_code' => '',
'deli_alternative_mobile' => '',
'deli_email' => '[email protected]',
'coll_address_1' => 'testing',
'coll_address_2' => 'testing 2',
'coll_postcode' => '11950',
'coll_city' => 'penang',
'deli_address_1' => 'test receiver',
'deli_address_2' => 'test receiver 2',
'deli_postcode' => '11950',
'deli_city' => 'penang',
'shipment_date' => '2024-05-11',
);
$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>";
?>
Response L1
Return Value | Type | Description | Remarks |
---|---|---|---|
result | array | Result for Purchase Insurance | |
status | string(7) | Get rate status is Success / Fail | |
error_code | int(5) | Error Code | Refer to Appendix I |
error_remark | string(100) | Error Message | Refer to Appendix I |
error_detail | object | Error Details | Only show detail when error code under 1001 |
api_status | string(10) | API Validation result | Refer to Appendix I |
Response L2
Return Value | Type | Description | Remarks |
---|---|---|---|
string(35) | The email address of the login email. | ||
name | string(35) | The name of the sender. | |
payment_number | string(10) | The payment reference number associated with the transaction. | |
insurance_amount | decimal(8,2) | The quoted amount for insurance coverage. | |
parcel_content_value | decimal(8,2) | The declared value of the parcel content. | |
awb | string(25) | The Air Waybill (AWB) number provided for tracking purposes. | |
shipment_date | date | The date of shipment for the parcel. | |
deli_name | string(35) | Receiver name. | |
parcel_content | string(35) | Description or contents of the parcel. | |
amount | decimal(8,2) | The total amount associated with the transaction. | |
send_email_status | string(100) | The status indicates whether the email notification has been sent. |
Response sample - Success
{
"result":{
"email":"[email protected]",
"name":"12313",
"payment_number":"EC-HXELB",
"insurance_amount":6.25,
"parcel_content_value":"250",
"awb":"TESTDomestic",
"shipment_date":"2024-05-11T00:00:00.000Z",
"deli_name":"Receiver Testing",
"parcel_content":"testing",
"amount":6.25,
"send_email_status":"email sent"
},
"status":"Success",
"error_code":0,
"error_remark":"",
"error_detail":"",
"api_status":"Success"
}
Response example - Fail
{
"result":[
],
"status":"",
"error_code":"3",
"error_remark":"Required api key",
"api_status":"Error"
}
Appendix I (API Return Status)
api_status | error_code | error_remark | ||
---|---|---|---|---|
Error | 3 | Required api key | ||
Error | 4 | Invalid api key | ||
Error | 5 | Unauthorized user | ||
Success | 0 |
Appendix II (Country Code List)
Short Country Name | Full Country Name | |||
---|---|---|---|---|
SG | SINGAPORE | |||
AU | AUSTRALIA | |||
BN | BRUNEI DARUSSALAM | |||
KH | CAMBODIA | |||
CA | CANADA | |||
CN | CHINA | |||
HK | HONG KONG | |||
JP | JAPAN | |||
MO | MACAU | |||
MM | MYANMAR | |||
MY | MALAYSIA | |||
NZ | NEW ZEALAND | |||
KR | KOREA, REPUBLIC OF | |||
TW | TAIWAN | |||
TH | THAILAND | |||
GB | UNITED KINGDOM | |||
US | UNITED STATES | |||
VN | VIETNAM |
Appendix IV (Insurance Courier List)
Courier | Courier Name | |||
---|---|---|---|---|
EP-CR0H | KEX Express | |||
EP-CR01 | UTS | |||
EP-CR03 | Aramex | |||
EP-CR05 | Skynet | |||
EP-CR0C | DHLeC | |||
EP-CR0DS | Flash Express | |||
EP-CR0A | Pos Laju | |||
EP-CR0DP | J&T Express | |||
EP-CR0DK | Pickupp | |||
EP-CR0DU | Ninjavan | |||
EP-CR0D3 | J&T Cargo | |||
EP-CR0U | TNT | |||
EP-CR0DH | Best Express | |||
EP-CR0D1 | City-Link Express | |||
EP-CR0T | FedEx | |||
EP-CR06 | Aramex International |