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).
POST
http://demo.connect.easyparcel.my/?ac=EPInsurancePurchase Body: application/x-www-form-urlencoded · action EPInsurancePurchase
Request parameters
Request L1
| Parameter | Type | Required | Description |
|---|---|---|---|
api | string(25) | Yes | Obtain from a registered account. |
awb | string(25) | Yes | The Air Waybill (AWB) number. |
parcel_ | double(8,2) | Yes | The declared value of the parcel content. |
courier | string(25) | Yes | Shipment courier. (Refer to Appendix IV) |
coll_ | string(2) | Yes | The country code of the collection address, limited to 'MY' or 'SG'. |
deli_ | string(2) | Yes | Receiver country code.Refer to ISO 3166-2 |
coll_ | string(35) | Yes | Sender’s state. (Refer to Appendix III) |
deli_ | string(35) | Yes | Receiver state. |
parcel_ | int(2) | Yes | The parcel category id (Refer to Get Parcel Category API) |
parcel_ | string(35) | Yes | The content of the parcel. |
parcel_ | string(8) | Yes | The type of parcel content, limited to 'document' or 'parcel'. |
parcel_ | string(3) | Yes | The currency code of the parcel content. |
parcel_ | double(8,2) | Yes | The weight of the parcel content. |
coll_ | string(35) | Yes | Sender name. |
coll_ | string(35) | No | Sender company |
coll_ | string(2) | Yes | Sender mobile country mobile , eg: 60 |
coll_ | string(16) | Yes | Sender mobile number |
coll_ | string(2) | No | Sender alternative mobile country mobile , eg: 60 |
coll_ | string(16) | No | Sender alternative mobile number |
coll_ | string(35) | No | Sender email |
deli_ | string(35) | Yes | Receiver name. |
deli_ | string(35) | No | Receiver company name. |
deli_ | string(2) | Yes | Receiver mobile country mobile , eg: 60 |
deli_ | string(35) | Yes | Receiver mobile number. |
deli_ | string(2) | No | Receiver alternative mobile country mobile , eg: 60 |
deli_ | string(35) | No | Receiver alternative mobile number. |
deli_ | string(35) | No | Receiver email address. |
coll_ | string(35) | Yes | Sender's address line 1. |
coll_ | string(35) | No | Sender's address line 2. |
coll_ | string(10) | Yes | Sender's postcode. |
coll_ | string(35) | Yes | Sender city |
deli_ | string(35) | Yes | Receiver address line 1. |
deli_ | string(35) | No | Receiver address line 2. |
deli_ | string(10) | Yes | Receiver postcode. |
deli_ | string(35) | Yes | Receiver city.. |
shipment_ | date | Yes | The date of the shipment in the format YYYY-MM-DD. |
Sample code
php
<?php
$domain = "http://demo.connect.easyparcel.my/?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>";
?>bash
curl -X POST 'http://demo.connect.easyparcel.my/?ac=EPInsurancePurchase' \
--data-urlencode 'api=xxxxxx' \
--data-urlencode 'awb=TESTDomestic' \
--data-urlencode 'parcel_content_value=250' \
--data-urlencode 'courier=EP-CR05' \
--data-urlencode 'coll_country=MY' \
--data-urlencode 'deli_country=MY' \
--data-urlencode 'coll_state=png' \
--data-urlencode 'deli_state=png' \
--data-urlencode 'parcel_category_id=12' \
--data-urlencode 'parcel_content=testing' \
--data-urlencode 'parcel_content_type=parcel' \
--data-urlencode 'parcel_content_currency_code=MYR' \
--data-urlencode 'parcel_content_weight=123' \
--data-urlencode 'coll_name=12313' \
--data-urlencode 'coll_company=Testing Company' \
--data-urlencode 'coll_mobile_code=60' \
--data-urlencode 'coll_mobile=162631234' \
--data-urlencode 'coll_alternative_mobile_code=60' \
--data-urlencode 'coll_alternative_mobile=123456789' \
--data-urlencode '[email protected]' \
--data-urlencode 'deli_name=Receiver Testing' \
--data-urlencode 'deli_company=Receiver Testing Company' \
--data-urlencode 'deli_mobile_code=60' \
--data-urlencode 'deli_mobile=123456789' \
--data-urlencode 'deli_alternative_mobile_code=' \
--data-urlencode 'deli_alternative_mobile=' \
--data-urlencode '[email protected]' \
--data-urlencode 'coll_address_1=testing' \
--data-urlencode 'coll_address_2=testing 2' \
--data-urlencode 'coll_postcode=11950' \
--data-urlencode 'coll_city=penang' \
--data-urlencode 'deli_address_1=test receiver' \
--data-urlencode 'deli_address_2=test receiver 2' \
--data-urlencode 'deli_postcode=11950' \
--data-urlencode 'deli_city=penang' \
--data-urlencode 'shipment_date=2024-05-11'Response
Response L1
| Field | Type | Description | Remarks |
|---|---|---|---|
result | array | Result for Purchase Insurance | |
status | string(7) | Get rate status is Success / Fail | |
error_ | int(5) | Error Code | Refer to Appendix I |
error_ | string(100) | Error Message | Refer to Appendix I |
error_ | object | Error Details | Only show detail when error code under 1001 |
api_ | string(10) | API Validation result | Refer to Appendix I |
Response L2
| Field | Type | Description | Remarks |
|---|---|---|---|
email | string(35) | The email address of the login email. | |
name | string(35) | The name of the sender. | |
payment_ | string(10) | The payment reference number associated with the transaction. | |
insurance_ | decimal(8,2) | The quoted amount for insurance coverage. | |
parcel_ | decimal(8,2) | The declared value of the parcel content. | |
awb | string(25) | The Air Waybill (AWB) number provided for tracking purposes. | |
shipment_ | date | The date of shipment for the parcel. | |
deli_ | string(35) | Receiver name. | |
parcel_ | string(35) | Description or contents of the parcel. | |
amount | decimal(8,2) | The total amount associated with the transaction. | |
send_ | string(100) | The status indicates whether the email notification has been sent. |
Response samples
json
{
"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"
}json
{
"result":[
],
"status":"",
"error_code":"3",
"error_remark":"Required api key",
"api_status":"Error"
}