Creating a Shipment with the COD Option

UPS

Example:

<?php
$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');

$package = new \RocketShipIt\Package('UPS');
$package->setParameter('codFundType', '0');
$package->setParameter('codAmount', '5.00');
$package->setParameter('length','5');
$package->setParameter('width','5');
$package->setParameter('height','5');
$package->setParameter('weight','5');

$shipment->addPackageToShipment($package);


$response = $shipment->submitShipment();

codFundType

  • 1 - cash only, for Canada
  • 9 - personal check, cashier’s check, or money order, no cash allowed)

FedEx

Example:

<?php
$shipment = new \RocketShipIt\Shipment('fedex');

$shipment->setParameter('toCompany', 'John Doe');
$shipment->setParameter('toName', '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('collectOnDelivery', 'YES');
$shipment->setParameter('currency', 'USD');
$shipment->setParameter('codCollectionType', 'CASH');
$shipment->setParameter('codCollectionAmount', '21.00');

$shipment->setParameter('length', '5');
$shipment->setParameter('width', '5');
$shipment->setParameter('height', '5');
$shipment->setParameter('weight','5');

$response = $shipment->submitShipment();

Note

The dropoffType parameter cannot be set to ‘DROP_BOX’ for COD shipments.

codCollectionType

  • ANY
  • CASH
  • GUARANTEED_FUNDS