Using dhl ecommerce carrier of easypost.Using their official php sdk. Not able to create manifest as I cannot buy the shipment without rate.
Type: EasyPost\Error Message: No rates found.
Filename: G:\xampp56\htdocs\shoppina\application\libraries\easypost-php-master\lib\EasyPost\Shipment.php Line Number: 287 Backtrace: File: G:\xampp56\htdocs\shoppina\application\controllers\Home.php Line: 5896 Function: lowest_rate
File: G:\xampp56\htdocs\shoppina\index.php Line: 309 Function: require_once
function easy_dummy()
{
$api_key = $this->crud_model->get_easypost_api_key("production");
$carrier_account_id = $this->crud_model->get_easypost_dhl_ecommerce_carrier_account_id();
/*$carrier_account = \EasyPost\CarrierAccount::retrieve($carrier_account_id);
echo "<pre>";
print_r($carrier_account);
echo "</pre>";*/
\EasyPost\EasyPost::setApiKey($api_key);
/*$my_carrier_accounts = \EasyPost\CarrierAccount::all();
echo "<pre>";
print_r($my_carrier_accounts);
echo "</pre>";die();*/
$to_address = \EasyPost\Address::create(
array(
"name" => "Dr. Steve Brule",
"street1" => "179 N Harbor Dr",
"city" => "Redondo Beach",
"state" => "CA",
"zip" => "90277",
"phone" => "310-808-5243"
)
);
$from_address = \EasyPost\Address::create(
array(
"company" => "EasyPost",
"street1" => "118 2nd Street",
"street2" => "4th Floor",
"city" => "San Francisco",
"state" => "CA",
"zip" => "94105",
"phone" => "415-456-7890"
)
);
$parcel = \EasyPost\Parcel::create(
array(
"predefined_package" => "LargeFlatRateBox",
"weight" => 1.0
)
);
$shipment = \EasyPost\Shipment::create(
array(
"to_address" => $to_address,
"from_address" => $from_address,
"parcel" => $parcel
)
);
//$shipment->buy(array('rate' => 100));
//$shipment->insure(array('amount' => 100));
$rates = $shipment->get_rates();
/*echo "<pre>";
print_r($rates);
echo "</pre>";
echo "<br><hr><br>";*/
/*$shipment->buy(array(
'rate' => $shipment->lowest_rate(),
'insurance' => 249.99
));*/
/* echo "<pre>";
print_r($shipment);
echo "</pre>";
echo "<br><hr><br>";*/
$my_carrier_accounts = \EasyPost\CarrierAccount::all();
echo "<pre>";
print_r($my_carrier_accounts);
echo "</pre>";
echo "<br><hr><br>";
$shipment->buy(array("rate" => $shipment->lowest_rate('dhlecommerce')));
if ($shipment) {
$batch = \EasyPost\Batch::create(array(
'shipments' => array($shipment->values)
));
/*echo "<pre>";
print_r($batch);
echo "</pre>";
echo "<br><hr><br>";*/
$batch->label(array('file_format' => 'png'));
$batch->create_scan_form();
}
// $shipment->postage_label->label_url;
}
Email in to [email protected]. They should get back to you in under 1 business day.