SmartPost and SurePost¶
UPS SurePost¶
Note
Your UPS account number must be activated to use UPS SurePost. If your account is not activated you will get this error: The Mailer ID is required on SurePost shipments
Rate Example:
<?php
// Note: Your UPS account must have SurePost access
$rate = new \RocketShipIt\Rate('UPS');
$rate->setParameter('toCode', '90210');
$rate->setParameter('weight', '5');
// SurePost service code for packages > 1 lb.
$rate->setParameter('service', '93');
$response = $rate->getRate();
Label Example:
<?php
// Note: Your UPS account must have SurePost access
$shipment = new \RocketShipIt\Shipment('UPS');
$shipment->setParameter('toCompany', 'John Doe');
$shipment->setParameter('toPhone', '1231231234');
$shipment->setParameter('toAddr1', '111 W Legion');
$shipment->setParameter('toCity', 'Whitehall');
$shipment->setParameter('toState', 'MT');
$shipment->setParameter('toCode', '59759');
$shipment->setParameter('service', '93'); // SurePost
$package = new \RocketShipIt\Package('UPS');
$package->setParameter('weight','5');
$shipment->addPackageToShipment($package);
$response = $shipment->submitShipment();
There are two service levels for SurePost; SurePost Under 1 pound and SurePost Over 1 pound. SurePost under 1 pound is 92.
So, weightUnit for Service Code 93 (SurePost over 1 pound) is LBS. And weightUnit for Service Code 93 (Sure Post under 1 bound) is OZS.
FedEx SmartPost¶
Rate Example:
<?php
$rate = new \RocketShipIt\Rate('FEDEX');
$rate->setParameter('toCode','90210');
$rate->setParameter('service', 'SMART_POST');
$rate->setParameter('smartPostIndicia', 'PARCEL_SELECT');
$rate->setParameter('smartPostHubId', '5531');
$rate->setParameter('weight','5');
$response = $rate->getSimpleRate();
Label Example:
<?php
$shipment = new \RocketShipIt\Shipment('fedex');
$shipment->setParameter('shipCity', 'Salt Lake City');
$shipment->setParameter('shipState', 'UT');
$shipment->setParameter('shipCode', '84101');
$shipment->setParameter('toCompany', 'John Doe');
$shipment->setParameter('toName', 'John Doe');
$shipment->setParameter('toPhone', '1231231234');
$shipment->setParameter('toAddr1', '111 W Legion');
$shipment->setParameter('toCity', 'Salt Lake City');
$shipment->setParameter('toState', 'UT');
$shipment->setParameter('toCode', '84101');
$shipment->setParameter('service', 'SMART_POST');
$shipment->setParameter('smartPostIndicia', 'PARCEL_SELECT');
$shipment->setParameter('smartPostHubId', '5552');
$shipment->setParameter('length', '5');
$shipment->setParameter('width', '5');
$shipment->setParameter('height', '5');
$shipment->setParameter('weight','5');
$response = $shipment->submitShipment();
Note
Services under 1lb need to use the PRESORTED_STANDARD service and smartPostEndorsement must be: ADDRESS_CORRECTION to avoid the error: “Invalid Ancillary Endorsement Type for PRESORTED_STANDARD Smart Post Shipment”