International Rates¶
RocketShipIt is capable of fetching international rates. Here are a few examples:
UPS¶
Single package single rate example:
<?php
$rate = new \RocketShipIt\Rate('UPS');
$rate->setParameter('toCode', 'V0K1G0');
$rate->setParameter('service', '65');
$rate->setParameter('toCountry', 'CA');
$package = new \RocketShipIt\Package('UPS');
$package->setParameter('weight', '5');
$rate->addPackageToShipment($package);
$response = $rate->getRate();
FedEx¶
Single package multi rate example:
<?php
// Great Britain
$rate = new \RocketShipIt\Rate('FedEx');
$rate->setParameter('toCode', 'DE214NW');
$rate->setParameter('toCountry', 'GB');
$package = new \RocketShipIt\Package('FedEx');
$package->setParameter('weight', '5');
$rate->addPackageToShipment($package);
$response = $rate->getAllRates();
// Canada
$rate = new \RocketShipIt\Rate('FedEx');
$rate->setParameter('toCode', 'K2B5K8');
$rate->setParameter('toCountry', 'CA');
$package = new \RocketShipIt\Package('FedEx');
$package->setParameter('weight', '5');
$rate->addPackageToShipment($package);
$response = $rate->getAllRates();
USPS¶
Single package multi rate example:
<?php
$rate = new \RocketShipIt\Rate('USPS');
$rate->setParameter('toName', 'John Smith');
$rate->setParameter('toCompany', 'Recipient Company');
$rate->setParameter('toCountry', 'CA');
$package = new \RocketShipIt\Package('usps');
$package->setparameter('weight', '20.3');
$package->setparameter('length', '1');
$package->setparameter('width', '2');
$package->setparameter('height', '3');
$package->setparameter('container', 'RECTANGULAR');
$rate->addPackageToShipment($package);
$response = $rate->getSimpleRates();
Stamps.com¶
Single package simple rate example:
<?php
$rate = new \RocketShipIt\Rate('STAMPS');
$rate->setParameter('toCountry', 'CA');
$rate->setParameter('toCode', 'S7N 2M1');
$rate->setParameter('weight', '5');
$response = $rate->getSimpleRates();
DHL¶
Single package simple rate example:
<?php
$rate = new \RocketShipIt\Rate('DHL');
$rate->setParameter('shipCity', 'San Francisco');
$rate->setParameter('shipCode', '94110');
$rate->setParameter('toCountry', 'CA');
$rate->setParameter('toCity', 'Toronto');
$rate->setParameter('toCode', 'M1B5K7');
$rate->setParameter('customsValue', '5');
$package = new \RocketShipIt\Package('DHL');
$package->setParameter('weight', '15');
$rate->addPackageToShipment($package);
$response = $rate->getSimpleRates();