Creating Non-postage-paid USPS Labels¶
If you don’t have a Stamps.com subscription you can still create USPS labels through RocketShipIt, they just wont have postage.
You will still need to take these packages to the post office and purchase postage to ship them. It is still useful to create labels this way as they will already contain a tracking number and barcode.
Example¶
Here is an example:
<?php
$shipment = new \RocketShipIt\Shipment('USPS');
$shipment->setParameter('toName', 'John Doe');
$shipment->setParameter('toPhone', '1231231234');
$shipment->setParameter('toAddr1', '123 Sycamore St');
$shipment->setParameter('toCity', 'San Francisco');
$shipment->setParameter('toState', 'CA');
$shipment->setParameter('toCode', '94110');
$shipment->setParameter('packagingType','PADDED FLAT RATE ENVELOPE';
$shipment->setParameter('weight','5');
$response = $shipment->submitShipment();
// Save label as a pdf
$shipment->toFile($response['pkgs'][0]['label_img'], '/tmp/label.pdf');
Note
USPS does not have multi-package shipments. All packages are considered shipments. If you need to send multiple packages to the same address create a new shipment for each package.
Adding a Reference Value¶
Just add the referenceValue parameter:
$shipment->setParameter('referenceValue', 'abc123');
Addons¶
Specify one or more addons comma separated:
$shipment->setParameter('addons', 'US-A-INS,US-A-SC');
See: Working With Addons
Email Notifications¶
Have USPS send an email when the package is scanned:
$shipment->setParameter('toEmail', 'someone@email.com');
packagingType¶
- VARIABLE (default)
- FLAT RATE ENVELOPE
- LEGAL FLAT RATE ENVELOPE
- PADDED FLAT RATE ENVELOPE
- GIFT CARD FLAT RATE ENVELOPE
- SM FLAT RATE ENVELOPE
- WINDOW FLAT RATE ENVELOPE
- SM FLAT RATE BOX
- MD FLAT RATE BOX
- LG FLAT RATE BOX
- REGIONALRATEBOXA
- REGIONALRATEBOXB
- RECTANGULAR
- NONRECTANGULAR