cancel
Showing results for 
Search instead for 
Did you mean: 
lenny1
First-timer (legacy)
Status: No status
Add Packing Slip functionality thru API Would love the ability to generate packing slips through your API. currently that is not supported. really hoping you will add that functionality soon.
13 Comments
BrettHuff
New Contributor

Adding my vote to get packing slips via the API.  At the very least, please make the pdf similar with or without the testLabel flag.  It's so incredibly frustrating to develop against test labels, only to find out that I now need to engineer a different solution for production labels.

pniadminlogin
New Contributor

so ran into same issues making a custom php sctrip to make a packing slip here is some of the code you can do it by using a Decimal to Hex here is the php function and demo code. you just need to feed the function the shipstation order ID: {"orders":[{"orderId":000000000

//Convert Dec to Hex
function dec2hex($number)
{
$hexvalues = array('0','1','2','3','4','5','6','7',
'8','9','A','B','C','D','E','F');
$hexval = '';
while($number != '0')
{
$hexval = $hexvalues[bcmod($number,'16')].$hexval;
$number = bcdiv($number,'16',0);
}
return $hexval;
}

 

//Convert Order ID into Hex
$getBarcodeHex = '^#^'.dec2hex($sh_orderId).'^';

 

@peter5 thanks for this thought was able to figure it out. whish they also told you about it in the api docs but nothing i could find.

VikingGawd
New Contributor

@SH @pniadminlogin Your welcome (new user name due to weird login issues)

I currently use this to create a qrcode in my app that can be scanned on the orders page to bring up the order and ship in shipstation.  Will do the shipping inside my app in the future but this was the quick and easy option at the moment.

Here is some PHP and Javascript code I should have added to my previous post

PHP:

$orderId = 11234567;
$barcode = '^#^' . strtoupper(dechex($orderId)) . '^';

And reverse barcode to order ID:

$fromBarcode = '^#^AB6D07^';
if (preg_match('/\^#\^[a-fA-F0-9]*\^/', $fromBarcode) === 1) {
$fromOrderId = hexdec(substr($fromBarcode, 3, -1));
}

Javascript:

const orderId = 11234567

const barcode = `^#^${orderId.toString(16).toUpperCase()}^`;
const barcodeLegacy = '^#^' & orderId.toString(16).toUpperCase() & '^';
 
And Reverse
const fromBarcode = '^#^AB6D07^'
let fromOrderId = null
if (/\^#\^[a-fA-F0-9]*\^/.test(fromBarcode)) {
fromOrderId = parseInt(fromBarcode.slice(3,-1), 16)
}