Skip to main content
Blog Magento

Integrating Magento With ShipStation

Suresh Selvam
September 21, 2016 |

Integrations are the key to stay ahead in eCommerce. Get your ERP integration from our Magento development team for your online store.

One of the Magento Enterprise projects that we recently implemented had the following requirement – to automate tasks associated with eCommerce fulfillment, order management, and shipping . Once automated, it will save many business hours to the client. ShipStation extension for Magento Enterprise was chosen for automating the same.

ShipStation is a web-based shipping solution that facilitates the order fulfillment process and allows to create shipping labels for all major carriers. A free extension is available on Magento Connect for communication between Magento and ShipStation.

This blog describes how to integrate ShipStation API with Magento to get rates (‘get shipping rates’) and create labels (‘create shipment labels’) for orders.

After installing the above extension, we need to create a SOAP or API User(s) in Magento and create roles with privileges that allows access to customers, orders, and products. All orders from Magento are synced to ShipStation.

ShipStation API

ShipStation API allows ‘read’ access to your account and ‘write’ access to specific objects like Orders, Customer, and Products.

This API can be used to automate many tasks like Managing Orders, Manage Shipments, Create Shipping Labels, Retrieving Shipping Rates … etc.

API Requirements

Endpoint

https://ssapi.shipstation.com/ .

Please Note: You cannot access this URL directly

Authentication

The ShipStation API uses Basic HTTP authentication. Use your ShipStation API Key as the username and API Secret as the password. You can find your API Key as the username and API Secret under Settings at https://ss.shipstation.com/#/settings/api .

The Authorization header is constructed as follows:

  • Username (API KEY) and password (API Secret) are combined into a string “username:password”
  • The resulting string is then encoded using the RFC2045-MIME variant of Base64, except not limited to 76 char/line
  • The authorization method and a space i.e. “Basic ” is then put before the encoded string.

For example, if the API KEY given is ‘ShipStation’ and the API Secret is ‘Rocks’ then the header is formed as follows:

PHP Code for Generate Authorization

  • Authorization: Basic U2hpc QxZm wZjhiFN0YXR wZjhipb24 wZjhi6Um9j wZjhia3M=

Server Responses

There are several responses are available, among them few status code given below.

  • 200 – OK – The request was successful (some API calls may return 201 instead).
  • 400 – Bad Request – The request could not be understood or was missing required parameters.
  • 401 – Unauthorized – Authentication failed or user does not have permissions for the requested operation.
  • 500 – Internal Server Error – ShipStation has encountered an error.

List of Carriers

Get all carriers which are configured in ShipStation.

Get Rates

Get all the shipping rates of carriers which are configured in Shipstation.  We need to send a couple of parameters in json format.

Create Label for Order

Creates a shipping label for a given order. The labelData field returned in the response is a base64 encoded PDF value. Simply decode and save the output as a PDF file to retrieve a printable label.

Before creating a label we need to get the orderId from Shipstation and also shipping address should be verified in the Shipstation account.

Hope the information provided was useful. Feel free to get in touch with us if you have any queries.

Reference

http://docs.shipstation.apiary.io/#reference

Suresh Selvam

Suresh, Technical Architect, is one of the senior most employees of DCKAP. He is Magento Developer Plus certified and an all-rounder with a range of technical & management skills. In crisis (technical or otherwise) , he steps in and restores order. He is helpful and always a phone call away.

More posts by Suresh Selvam