How to create a shipping label using ShipStation API?

How to create a shipping label using ShipStation API? – Today we will see how to create a shipping label using ShipStation API. ShipStation is the software that is widely used to simplify the order process of an eCommerce website.

Several situations we want to allow the customer to generate the shipping label for the returns and other processes too. So let’s see step by step of the generating process. Today I will explain the process with PHP script.

Use a proper class for this( A controller or Helper class ). I am writing this based on magento 2.

  1. Generate customer address ( Ship From ).
  2. Generate store address ( Ship To).
  3. Create Authorization.
  4. Request the label creation.
  5. Convert the result to PDF and save in a Directory.

Generate customer address.

Just consider this as a product return process. So we want to consider the customer’s default billing address as the ship from address. Use whatever the right way to get the billing address of the order.

Generate store address.

This address should be where the return wants to reach. Here I will consider the store address as Ship To address.

Create Authorization.

Next, we want to create authorization using the API key and API Secret. Check how to create the Authorization key.

Request the label creation.

Using the php shipstation script we can create the label. Below is the code snippet.

Above I am passing the “testLabel” variable true to generate the test labels. You want to pass the right carrierCode, serviceCode, packageCode in the script. Pass appropriate arguments according to your need and get the printing label. You may use the API calls to get the carrierCode, serviceCode, packageCode to use in this script.

Convert the result to PDF and save in a Directory.

Get the response from the script and decode it.

With this section, we can request to create the shipping label using shipStation API. Once we run this code set we can get the shipping label.

This is the wrap-up of the entire article. To create the shipping label we need senders address, receivers address, authorization key. With these, we can use shipStation API to create a shipping label.

I hope this will help someone to easily understand the shipping label creation. Share your thoughts, corrections with this article, and SHARE with your valuable contacts.

Reference – https://www.shipstation.com/docs/api/

5 thoughts on “How to create a shipping label using ShipStation API?”

  1. I’ve been surfing online more than 2 hours today,
    yet I never found any interesting article like yours.
    It’s pretty worth enough for me. In my opinion, if all webmasters and bloggers made good content as you did,
    the internet will be much more useful than ever before. I could not resist commenting. Exceptionally well written! Hi, I do think this is an excellent web site. I stumbled upon it 😉 I will revisit yet again since I bookmarked it. Money and freedom is the greatest way to change, may you be rich and continue to guide others.

  2. It’s a pity you don’t have a donate button! I’d definitely donate to this fantastic blog!

    I suppose for now i’ll settle for bookmarking and adding your RSS feed to my Google account.
    I look forward to new updates and will share this blog with my Facebook group.

  3. Like!! I blog frequently and I really thank you for your content. The article has truly peaked my interest.

Leave a Reply

Your email address will not be published. Required fields are marked *