Skip to main content

ShipStation Integration

The Middleware Platform integrates with ShipStation (a multi-carrier shipping management platform) to ingest real-time order and shipment data. This data powers the Shipping Dashboard and provides a local record of all fulfilment activity.


Architecture

ShipStation
│ ORDER_NOTIFY / SHIP_NOTIFY webhook

POST /api/webhooks/shipstation/order-notify
POST /api/webhooks/shipstation/ship-notify


ShipStationWebhookController


ShipStationService::fetchFromUrl() ← calls ShipStation REST API


Eloquent upsert into shipstation_orders + shipstation_order_items + shipstation_shipments

Webhook Events

ShipStation sends two event types to the middleware:

ORDER_NOTIFY

Triggered when an order is created or updated in ShipStation.

Endpoint: POST /api/webhooks/shipstation/order-notify

The controller:

  1. Validates that resource_url and resource_type are present in the payload.
  2. Calls ShipStationService::fetchFromUrl($resourceUrl) to retrieve the full order detail from ShipStation's REST API.
  3. Iterates over each order in the response and upserts a ShipStationOrder record.
  4. Upserts all ShipStationOrderItem records for the order.

SHIP_NOTIFY

Triggered when a shipment is created for an order.

Endpoint: POST /api/webhooks/shipstation/ship-notify

The controller upserts a ShipStationShipment record including tracking information.


Data Models

ShipStationOrder

ColumnDescription
order_idShipStation's internal order ID (unique key)
order_numberHuman-readable order number (matches WooCommerce order number)
order_dateWhen the order was placed
order_statusShipStation order status
ship_dateActual ship date
shipby_dateCommitted ship-by date
amount_paidTotal amount paid
shipping_amountShipping charge
carrier_codeCarrier (e.g., fedex, ups)
service_codeService level (e.g., fedex_ground)
weightOrder weight in ounces
raw_dataFull JSON payload from ShipStation (archived for debugging)

ShipStationOrderItem

ColumnDescription
order_idFK to shipstation_orders.order_id
skuProduct SKU
nameProduct name
quantityQuantity ordered
unit_priceUnit price at time of order

ShipStationShipment

ColumnDescription
shipment_idShipStation's internal shipment ID
order_idFK to shipstation_orders.order_id
tracking_numberCarrier tracking number
carrier_codeCarrier used
ship_dateActual ship date
raw_dataFull JSON payload

Configuration

Set ShipStation API credentials in .env:

SHIPSTATION_API_KEY=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
SHIPSTATION_API_SECRET=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

In ShipStation, configure webhooks to point to the middleware:

EventURL
Order Notifyhttps://dash.scottsdalemint.com/api/webhooks/shipstation/order-notify
Ship Notifyhttps://dash.scottsdalemint.com/api/webhooks/shipstation/ship-notify

Key Files

FileDescription
app/Http/Controllers/ShipStationWebhookController.phpWebhook handler
app/Services/ShipStationService.phpREST API client
app/Models/ShipStationOrder.phpOrder model
app/Models/ShipStationOrderItem.phpOrder item model
app/Models/ShipStationShipment.phpShipment model