I don't understand what's missing for an international delivery. The API returns: "Atleast one item data is required" and refuses to create the label.
Here's my code :
$delivery_costs = $transporter->delivery_costs;
switch ($carrierData['weight']) {
case 2000:
$delivery_price = 'cost_1';
break;
default:
$delivery_price = 'cost_2';
break;
}
if (is_numeric($delivery_costs[$carrierData['country']][$delivery_price])) {
$temp_price = (float)$delivery_costs[$carrierData['country']][$delivery_price];
if ($temp_price >= 0.00 && $temp_price <= 999.99) {
$formatted_price = number_format($temp_price, 2);
} else {
// La valeur est en dehors des limites autorisées
$formatted_price = "0.00";
}
} else {
// La valeur n'est pas numérique
$formatted_price = "0.00";
}
$customsInfo = new Box\CustomsInfo\CustomsInfo();
$customsInfo->setParcelValue($carrierData['total']); // INT
$customsInfo->setCurrency(Bpost\Order\Box\CustomsInfo\CustomsInfo::CUSTOM_INFO_CURRENCY_EUR);
$customsInfo->setAmtPostagePaidByAddresse($formatted_price); //FLOAT : String
$customsInfo->setContentDescription('FASHION');
$customsInfo->setShipmentType(Bpost\Order\Box\CustomsInfo\CustomsInfo::CUSTOM_INFO_SHIPMENT_TYPE_GOODS);
$customsInfo->setParcelReturnInstructions(Bpost\Order\Box\CustomsInfo\CustomsInfo::CUSTOM_INFO_PARCEL_RETURN_INSTRUCTION_RTS);
$customsInfo->setPrivateAddress(true);
$international = new Box\International();
$international->setProduct(Bpost\ProductConfiguration\Product::PRODUCT_NAME_BPACK_WORLD_BUSINESS);
$international->setReceiver($receiver);
$international->setParcelWeight($carrierData['weight']);
$international->setCustomsInfo($customsInfo);
$box->setInternationalBox($international);
I don't understand what's missing for an international delivery. The API returns: "Atleast one item data is required" and refuses to create the label.
Here's my code :