Creating Return Labels

What is a Return Label?

A Return label is required when you are shipping back to shipper. This is usually called a non-forward shipment. The subtle differences include:

  • Charges are not applied until after the label is used
  • Ability to schedule pickup on customer’s behalf
  • Inability to void the label after it is printed

UPS

Generate a Return Label

The following code will generate a return label:

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

// Values:
// '2' - UPS Print and Mail Return Label
// '3' - UPS One-Attempt Return Label
//   * UPS One-Attempt Return Label is not valid return service with UPS Premium Care accessorial.
// '5' - UPS Three Attempt Return Label.
//   * UPS Three Attempt Return Label are not valid for UPS Worldwide Express Freight Services.
// '8' - UPS Electronic Return Label
// '9' - UPS Print Return Label
// '10' - UPS Exchange Print Return Label
$shipment->setParameter('returnCode', '9');

$shipment->setParameter('toCompany', 'Return To me LLC');
$shipment->setParameter('toPhone', '1231231234');
$shipment->setParameter('toAddr1', '101 W Main');
$shipment->setParameter('toCity', 'Bozeman');
$shipment->setParameter('toState', 'MT');
$shipment->setParameter('toCode', '59715');

$shipment->setParameter('fromName', 'Your Customer');
$shipment->setParameter('fromAddr1', '101 W Main');
$shipment->setParameter('fromCity', 'Whitehall');
$shipment->setParameter('fromState', 'MT');
$shipment->setParameter('fromCode', '59759');

$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();

print_r($response);

Have UPS automatically send the label via email

Alternatively you can have UPS email your return label to the customer on your behalf:

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

$shipment->setParameter('returnCode', '8');
$shipment->setParameter('returnEmailAddress','yourcustomer@email.com');
$shipment->setParameter('returnUndeliverableEmailAddress','support@rocketship.it');
$shipment->setParameter('returnFromEmailAddress','support@rocketship.it');
$shipment->setParameter('returnEmailFromName','RocketShipIt LLC');

$shipment->setParameter('toCompany', 'John Doe');
$shipment->setParameter('toPhone', '1231231234');
$shipment->setParameter('toAddr1', '101 W Main');
$shipment->setParameter('toCity', 'Bozeman');
$shipment->setParameter('toState', 'MT');
$shipment->setParameter('toCode', '59715');

$shipment->setParameter('fromName', 'Mark Sanborn');
$shipment->setParameter('fromAddr1', '101 W Main');
$shipment->setParameter('fromCity', 'Whitehall');
$shipment->setParameter('fromState', 'MT');
$shipment->setParameter('fromCode', '59759');

$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();

print_r($response);

FedEx

Generate a Return Label

Note

Remember to set the to address as the business/person the package is returning to.

Example:

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

$shipment->setParameter('shipper', 'John Doe Customer');
$shipment->setParameter('shipAddr1', '123 Main St.');
$shipment->setParameter('shipCity', 'Bozeman');
$shipment->setParameter('shipCode', '59715');
$shipment->setParameter('shipState', 'MT');

$shipment->setParameter('toCompany', 'RocketShipIt Returns');
$shipment->setParameter('toName', 'Returns Department');
$shipment->setParameter('toPhone', '1231231234');
$shipment->setParameter('toAddr1', '111 W Legion');
$shipment->setParameter('toCity', 'Whitehall');
$shipment->setParameter('toState', 'MT');
$shipment->setParameter('toCode', '59759');
$shipment->setParameter('returnCode', 'PRINT_RETURN_LABEL');

// $shipment->setParameter('notifyOnShipment', 'YES');
// $shipment->setParameter('notifyOnException', 'YES');
// $shipment->setParameter('notifyOnDelivery', 'YES');
// $shipment->setParameter('notifyOnTender', 'YES');

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

$response = $shipment->submitShipment();

USPS

Generate a USPS Merchandise Return Label

Example:

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

$shipment->setParameter('fromName', 'Your Customer');
$shipment->setParameter('fromAddr1', '111 W Legion');
$shipment->setParameter('fromCity', 'Whitehall');
$shipment->setParameter('fromState', 'MT');
$shipment->setParameter('fromCode', '59759');

$shipment->setParameter('permitNumber', '293829');
$shipment->setParameter('permitIssuingPOCity', 'New York');
$shipment->setParameter('permitIssuingPOState', 'NY');
$shipment->setParameter('permitIssuingPOZip5', '10001');

$shipment->setParameter('pduFirmName', 'My Firm');
$shipment->setParameter('pduPOBox', 'PO Box 100');
$shipment->setParameter('pduCity', 'Wilkes Barre');
$shipment->setParameter('pduState', 'PA');
$shipment->setParameter('pduZip5', '18702');
$shipment->setParameter('pduZip4', '1234');

$shipment->setParameter('referenceValue', '1234');

$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('weight', '5');

// Uncomment to send automated emails
// $shipment->setParameter('returnEmailFromName', 'Your Company');
// $shipment->setParameter('returnFromEmailAddress', 'youremail@yourcompany.com');
// $shipment->setParameter('returnToName', 'John Doe');
// $shipment->setParameter('returnEmailAddress', 'yourcustomer@email.com');

// $shipment->setParameter('insuredValue', '100.50');  // add insurance

$response = $shipment->submitShipment();

DHL

Note

DHL does not currently support return labels.