International Shipping¶
RocketShipIt is capable of producing valid international labels. Here are a few examples:
UPS¶
Australia¶
Example:
<?php
$shipment = new \RocketShipIt\Shipment('UPS');
$shipment->setParameter('toCompany', 'Australia Zoo');
$shipment->setParameter('toName', 'Mark Sanborn');
$shipment->setParameter('toAttentionName', 'Mark Sanborn');
$shipment->setParameter('toPhone', '17077262676');
$shipment->setParameter('toAddr1', '1638 Steve Irwin Way');
$shipment->setParameter('toCity', 'Beerwah');
$shipment->setParameter('toCode', '4519');
$shipment->setParameter('toCountry', 'AU');
$shipment->setParameter('shipPhone', '17077262676');
$shipment->setParameter('service', '65');
$package = new \RocketShipIt\Package('UPS');
$package->setParameter('length','5');
$package->setParameter('width','5');
$package->setParameter('height','5');
$package->setParameter('weight','5');
$shipment->addPackageToShipment($package);
$response = $shipment->submitShipment();
Mexico¶
Example:
<?php
$shipment = new \RocketShipIt\Shipment('UPS');
$shipment->setParameter('toCompany', 'Cancun International Airport');
$shipment->setParameter('toName', 'Mark Sanborn');
$shipment->setParameter('toAttentionName', 'Mark Sanborn');
$shipment->setParameter('toPhone', '17077262676');
$shipment->setParameter('toAddr1', 'Caretera Cancun-Chetumal KM 22');
$shipment->setParameter('toCity', 'Cancun');
$shipment->setParameter('toCode', '77500');
$shipment->setParameter('toCountry', 'MX');
$shipment->setParameter('shipPhone', '17077262676');
$shipment->setParameter('service', '65');
$package = new \RocketShipIt\Package('UPS');
$package->setParameter('length','5');
$package->setParameter('width','5');
$package->setParameter('height','5');
$package->setParameter('weight','5');
$shipment->addPackageToShipment($package);
$response = $shipment->submitShipment();
Canada¶
Example:
<?php
$shipment = new \RocketShipIt\Shipment('UPS');
$shipment->setParameter('toCompany', 'ACOA Head Office');
$shipment->setParameter('toName', 'Mark Sanborn');
$shipment->setParameter('toAttentionName', 'Mark Sanborn');
$shipment->setParameter('toPhone', '17077262676');
$shipment->setParameter('toAddr1', '644 Main Street');
$shipment->setParameter('toCity', 'Moncton');
$shipment->setParameter('toState', 'NB');
$shipment->setParameter('toCode', 'E1C9J8');
$shipment->setParameter('toCountry', 'CA');
$shipment->setParameter('shipPhone', '17077262676');
$shipment->setParameter('monetaryValue', '45');
$shipment->setParameter('service', '65');
$package = new \RocketShipIt\Package('UPS');
$package->setParameter('length','5');
$package->setParameter('width','5');
$package->setParameter('height','5');
$package->setParameter('weight','5');
$shipment->addPackageToShipment($package);
$response = $shipment->submitShipment();
FedEx¶
Canada Example:
<?php
$shipment = new \RocketShipIt\Shipment('fedex');
$shipment->setParameter('toCompany', 'John Doe');
$shipment->setParameter('toName', 'John Doe');
$shipment->setParameter('toPhone', '1231231234');
$shipment->setParameter('toAddr1', '361A Old Finch Avenue');
$shipment->setParameter('toCity', 'Toronto');
$shipment->setParameter('toState', 'ON');
$shipment->setParameter('toCode', 'M1B5K7');
$shipment->setParameter('toCountry', 'CA');
$shipment->setParameter('service', 'INTERNATIONAL_ECONOMY');
$shipment->setParameter('packagingType', 'FEDEX_BOX');
$shipment->setParameter('length', '5');
$shipment->setParameter('width', '5');
$shipment->setParameter('height', '5');
$shipment->setParameter('weight','5');
$shipment->setParameter('customsCurrency', 'USD');
$shipment->setParameter('customsValue', '20.00');
$shipment->setParameter('customsAccountNumber', '123123123');
$customs = new \RocketShipIt\Customs('fedex');
$customs->setParameter('customsNumberOfPieces', '1');
$customs->setParameter('countryOfManufacture', 'US');
$customs->setParameter('weightUnit', 'LB');
$customs->setParameter('customsDescription', 'Industrial Dishwasher');
$customs->setParameter('customsWeight', '5');
$customs->setParameter('customsQuantity', '1');
$customs->setParameter('customsQuantityUnits', 'ea');
$customs->setParameter('customsLineAmount', '20.00');
$shipment->addCustomsLineToShipment($customs);
$response = $shipment->submitShipment();
South Africa:
<?php
$shipment = new \RocketShipIt\Shipment('fedex');
$shipment->setParameter('toCompany', 'Johannesburg Zoo');
$shipment->setParameter('toName', 'adsf');
$shipment->setParameter('toPhone', '9259891239');
$shipment->setParameter('toAddr1', '1 Upper Park Drive');
$shipment->setParameter('toCity', 'Johannesburg');
//$shipment->setParameter('toState', '');
$shipment->setParameter('toCode', '2122');
$shipment->setParameter('toCountry', 'ZA');
$shipment->setParameter('service', 'INTERNATIONAL_ECONOMY');
$shipment->setParameter('packagingType', 'FEDEX_BOX');
$shipment->setParameter('length', '5');
$shipment->setParameter('width', '5');
$shipment->setParameter('height', '5');
$shipment->setParameter('weight','5');
//$shipment->setParameter('customsDocumentContent', 'NON_DOCUMENTS');
$shipment->setParameter('customsCurrency', 'USD');
$shipment->setParameter('customsValue', '20.00');
$customs = new \RocketShipIt\Customs('fedex');
$customs->setParameter('customsNumberOfPieces', '6');
$customs->setParameter('countryOfManufacture', 'US');
$customs->setParameter('weightUnit', 'LB');
$customs->setParameter('customsDescription', 'appliances');
$customs->setParameter('customsWeight', '5');
$customs->setParameter('customsQuantity', '1');
$customs->setParameter('customsQuantityUnits', 'ea');
$customs->setParameter('customsLineAmount', '20.00');
$shipment->addCustomsLineToShipment($customs);
$response = $shipment->submitShipment();
USPS¶
Canada¶
Example:
<?php
$shipment = new \RocketShipIt\Shipment('STAMPS');
$shipment->setParameter('toName', 'Toronto Zoo');
$shipment->setParameter('toAddr1', '2000 Meadowvale Road');
$shipment->setParameter('toCity', 'Toronto');
$shipment->setParameter('toState', 'MB');
$shipment->setParameter('toPhone', '7077262676');
$shipment->setParameter('toCode', 'M1B5K7');
$shipment->setParameter('toCountry', 'CA');
# customs
$shipment->setParameter('customsContentType', 'Commercial Sample');
# customs lines
$custLines = new \RocketShipIt\Customs('STAMPS');
$custLines->setParameter('customsDescription', 'my shipment');
$custLines->setParameter('customsQuantity', '1');
$custLines->setParameter('customsWeight', '2.5');
$custLines->setParameter('customsValue', '5.00');
$custLines->setParameter('customsHsTariff', '');
$custLines->setParameter('customsOriginCountry', 'US');
$shipment->addCustomsLineToShipment($custLines);
$shipment->addCustomsLineToShipment($custLines);
$rate = new \RocketShipIt\Rate('STAMPS');
$rate->setParameter('customsValue','200');
$rate->setParameter('toCountry','CA');
$rate->setParameter('weight','5');
$response = $rate->getAllRates();
$rates = $response->Rates;
$rate = $rates->Rate;
$package = $rate[0];
$package->AddOns = null;
$shipment->addPackageToShipment($package);
$response = $shipment->submitShipment();
Note
Stamps.com may return customs documents or other related information with the label. The URL returned for each piece of information is separated by a space character.
Can weight parameters be in Ounces instead of LBS?
The USPS API accepts pounds and ounces but RocketShipIt tries to simplify this for you by converting pounds to pounds/ounces to match other carriers that don’t support ounces. If you use a fractional pound RocketShipIt will convert the weight to ounces for you.
DHL¶
Example:
<?php
$shipment = new \RocketShipIt\Shipment('dhl');
$shipment->setParameter('regionCode', 'AM');
$shipment->setParameter('shipper', 'RocketShipIt');
$shipment->setParameter('shipAddr1', '76 Sycamore St');
$shipment->setParameter('shipCity', 'San Francisco');
$shipment->setParameter('shipState', 'California');
$shipment->setParameter('shipCode', '94110');
$shipment->setParameter('shipCountry', 'US');
$shipment->setParameter('toCompany', 'TAU International');
$shipment->setParameter('toAddr1', 'Carter Building , Room 108');
$shipment->setParameter('toCity', 'Ramat Aviv');
$shipment->setParameter('toState', 'Tel Aviv');
$shipment->setParameter('toCode', '6997801');
$shipment->setParameter('toCountry', 'IL');
$shipment->setParameter('toName', 'Mark Sanborn');
$shipment->setParameter('toPhone', '1234567');
$shipment->setParameter('service', 'P');
$shipment->setParameter('weight', '5');
$shipment->setParameter('isDutiable', 'Y');
$shipment->setParameter('tradeTerms', 'EXW');
$shipment->setParameter('scheduleB', '9030.90.8400');
$shipment->setParameter('exportLicense', '9030.90.8400');
$shipment->setParameter('eccn', '1234');
$shipment->setParameter('dutyPaymentType', 'T'); // S:Shipper, R:Recipient, T:Third Party.
//$shipment->setParameter('dutyAccountNumber', '1234599');
$shipment->setParameter('customsDescription', 'Software');
$shipment->setParameter('monetaryValue', '100');
$shipment->setParameter('referenceValue', 'My Shipment');
$response = $shipment->submitShipment();
Canada Post¶
Example:
<?php
$shipment = new \RocketShipIt\Shipment('CANADA');
$shipment->setParameter('shipState', 'ON');
$shipment->setParameter('shipCity', 'Ottawa');
$shipment->setParameter('shipCode', 'K1A0B1');
$shipment->setParameter('toName', 'Mark Sanborn');
$shipment->setParameter('toAddr1', '940 Presidio Ave');
$shipment->setParameter('toCity', 'San Francisco');
$shipment->setParameter('toState', 'CA');
$shipment->setParameter('toCode', '94115');
$shipment->setParameter('toCountry', 'US');
$shipment->setParameter('toPhone', '7077262676');
$shipment->setParameter('service', 'USA.EP');
$shipment->setParameter('weight', '5');
$shipment->setParameter('length', '5');
$shipment->setParameter('width', '5');
$shipment->setParameter('height', '5');
$shipment->setParameter('optionCode', 'RASE');
$customs = new \RocketShipIt\Customs('CANADA');
$customs->setParameter('customsDescription', 'Industrial Dishwasher');
$customs->setParameter('customsWeight', '5');
$customs->setParameter('customsQuantity', '1');
$customs->setParameter('customsValue', '20.00');
$customs->setParameter('customsAccountNumber', '123123123');
$customs->setParameter('customsQuantityUnits', 'ea');
$customs->setParameter('customsLineAmount', '20.00');
$customs->setParameter('customsCurrency', 'USD');
$shipment->addCustomsLineToShipment($customs);
$response = $shipment->submitShipment();