From 5341617921ece4c4c3abcd47971b4ac50fe7b920 Mon Sep 17 00:00:00 2001 From: Casper Bakker Date: Fri, 14 Aug 2020 10:53:48 +0200 Subject: [PATCH] Add example of international shipment --- README.md | 40 ++++++++++++++++++++++++++++++++++++++-- 1 file changed, 38 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 463a42f..d307467 100644 --- a/README.md +++ b/README.md @@ -34,16 +34,18 @@ $parcel = $sendcloudClient->parcels()->find(2342); ```php $parcel = $sendcloudClient->parcels(); +$parcel->shipment = 10; // Shipping method, get possibilities from $sendCloud->shippingMethods()->all() + $parcel->name = 'John Smith'; $parcel->company_name = 'ACME'; $parcel->address = 'Wellingtonstreet 25'; $parcel->city = 'Wellington'; $parcel->postal_code = '3423 DD'; $parcel->country = 'NL'; -$parcel->requestShipment = true; -$parcel->shipment = 10; // Shipping method, get possibilities from $sendCloud->shippingMethods()->all() $parcel->order_number = 'ORDER2014-52321'; +$parcel->requestShipment = true; // Specifically needed to create a shipment after adding the parcel + $parcel->save(); ``` @@ -64,3 +66,37 @@ try { throw new Exception($e->getMessage()); } ``` + +## Create an international parcel +```php +$parcel = $sendcloudClient->parcels(); + +$parcel->shipment = 9; // Shipping method, get possibilities from $sendCloud->shippingMethods()->all() + +$parcel->name = 'John Smith'; +$parcel->company_name = 'ACME'; +$parcel->address = 'Wellingtonstreet 25'; +$parcel->city = 'Wellington'; +$parcel->postal_code = '3423 DD'; +$parcel->country = 'CH'; +$parcel->order_number = 'ORDER2014-52321'; +$parcel->weight = 20.4; + +// For international shipments +$parcel->customs_invoice_nr = 'ORD9923882'; +$parcel->customs_shipment_type = 2; // Commercial goods +$parcel->parcel_items = [ + [ + 'description' => 'Cork', + 'quantity' => 2, + 'weight' => 10.2, + 'value' => 12.93, + 'hs_code' => '992783', + 'origin_country' => 'CN', + ] +]; + +$parcel->requestShipment = true; // Specifically needed to create a shipment after adding the parcel + +$parcel->save(); +```