Back to Top

libraries > Shiphawk.js

new Shiphawk()

Create ShipHawk Shipping labels. See the Create Shipping Labels With ShipHawk When Order Is Fulfilled template for an example.

Properties

Name Type Description
shiphawkKey string

The Key from your Shiphawk Project's Page.

shiphawkSecret string

The Secret from your Shiphawk Project's Page.

Returns

Shiphawk

Shiphawk.createRateRequest(data)

Create a ShipHawk Rate Request.

Parameters

Name Type Description
data object
data.items array

Array of Rate Item Request objects. See https://apidocs.shiphawk.com/#rate-item-request-object.

data.type.weight float

The weight of the package in pounds

data.type.length float

The length of the package in inches

Optional
data.type.width float

The width of the package in inches

Optional
data.type.height float

The height of the package in inches

Optional
data.value float

The value of the package in dollars

Optional
data.origin_address object

Address Object representing the destination address. See https://apidocs.shiphawk.com/#address-resources.

data.origin_address.zip string

The origin address zip code

data.destination_address object

Address Object representing the destination address. See https://apidocs.shiphawk.com/#address-resources.

data.destination_address.zip string

The destination address zip code

Returns

object

Shiphawk.createShipment(data)

Create a ShipHawk shipment

Parameters

Name Type Description
data object
data.rate_id string

The Rate ID returned by a request to Shiphawk.createRateRequest(data).

data.origin_address object

Address Object representing the origin address. See https://apidocs.shiphawk.com/#address-resources.

data.destination_address object

Address Object representing the destination address. See https://apidocs.shiphawk.com/#address-resources.

data.label_format string

Default: PDF values: ZPL, PDF

Optional
data.include_return_label boolean

Default: false

Optional

Returns

object

Shiphawk.sanitizeAddress(shopifyAddress[, email, phoneNumber])

Convert a Shopify address to a ShipHawk Address resource.

Parameters

Name Type Description
shopifyAddress object
email string Optional
phoneNumber string Optional

Returns

object Object

Shiphawk.request(method, endpoint, data, options)

Make a ShipHawk API request

Parameters

Name Type Description
method string
endpoint string
data object
options object

Returns

Object