Shipping

Shippit shipping for GoCommerce

A Go package that books an order with Shippit when an operator ships it, then fetches the label. You pick a service band; Shippit picks the courier, and the module records whichever one took the parcel.

What it does

The module registers “shippit” as a fulfillment provider. An operator ships through the engine’s own POST /api/admin/create-fulfillment with the provider shippit — the engine keeps the order’s state and its events, and the module only talks to Shippit.

Shippit books and labels in two calls: POST /orders comes back with a tracking number, and GET /orders/{tracking}/label with a pre-signed URL to print. The booking is what matters — once it succeeds, in the package’s words, the parcel is Shippit’s problem — so a label that cannot be fetched is logged and the shipment still stands.

In the admin it describes itself as “Shippit’s carrier allocation, Australia and New Zealand: pick a service band and Shippit picks the courier.” The band is standard, express, priority, or plain_label for a store that books its own carrier and only wants the paperwork. No SDK: REST over Go’s standard library.

Configuration

Two settings are required: the API key and a default service band. Set them in Config from your own main(), or leave Config empty and fill them in under Settings › Shipping providers.

Shippit module settings — 7 settings, 2 required
SettingEnvironment variableRequiredWhat it does
APIKey
API key
SHIPPIT_API_KEY Yes A Shippit API key, sent as a bearer token. Staging takes a different key.
CourierType
Service band
— Yes standard, express, priority or plain_label. Meta courier_type overrides it for one parcel.
AuthorityToLeave
Authority to leave
— No Whether a courier may leave the parcel at the door when nobody answers. Off by default: it is the shopper’s call, and a storefront that asks passes the answer per shipment with meta authority_to_leave.
DefaultWeightGrams
Default weight (grams)
— No Per unit, for a parcel holding a variant with no weight recorded. 500 by default.
DefaultLengthMM, DefaultWidthMM, DefaultHeightMM — No The box sent when the engine has no unambiguous size, which is any parcel holding more than one unit. 150 × 150 × 100 mm by default. Go only.
BaseURL
API base URL
— No Overrides https://app.shippit.com/api/3. Staging is https://app.staging.shippit.com/api/3, with its own key.
Client — No Replaces the HTTP client, which otherwise times out after 30 seconds. Go only; not in the panel.

The module reads its Config struct, not the environment. The variable names are the ones the package’s own example or the reference binary uses; in your own main() you choose where each value comes from. Where a setting has a panel label, the admin’s settings drawer can hold it too, and a value typed there wins over Config.

Setting it up

  1. Get an API keyIn Shippit, create an API key — a staging key if you are trying it against Shippit’s staging host — and decide the service band to book by default.
  2. Install the moduleImport it and pass shippit.New to gocommerce.New, as below — or run the reference binary with -carriers, which installs every carrier module idle.
  3. Fill in the settingsKey and service band, in Config or under Settings › Shipping providers, and authority to leave if the store’s default is yes. A value typed into the panel counts on the next shipment.
  4. Ship an orderPOST /api/admin/create-fulfillment with the order id and the provider shippit. The engine records the tracking number and label URL and moves the order to shipped, or to partial.

main.go

import (
	"os"

	"github.com/itswadesh/gocommerce/core"
	shippit "github.com/itswadesh/gocommerce/ext/fulfill-shippit"
)

app, err := gocommerce.New(cfg,
	shippit.New(shippit.Config{
		APIKey:      os.Getenv("SHIPPIT_API_KEY"),
		CourierType: "standard",
	}),
)

The package doc’s own example, with its imports; cfg is your gocommerce.Config. With an empty shippit.Config the module installs idle and waits for the panel. Import path github.com/itswadesh/gocommerce/ext/fulfill-shippit.

How it works

What it does not do

Read these before an order depends on it. No store is known to run GoCommerce in production yet, so these come from the code, not from anyone’s experience.

FAQ

Questions about the Shippit module

Can I choose the courier?

Shippit chooses within the service band by default. For a parcel an operator has already promised to one carrier, meta courier_allocation names it, and meta courier_type changes the band for that parcel.

Why are my parcel’s sides smaller than one?

Because Shippit reads metres. The engine keeps millimetres and the module divides by a thousand, so a 305 mm box goes as 0.305. Weight goes the same way, grams to kilograms.

Can I use it without writing Go?

Yes. The reference binary’s -carriers flag installs every carrier module with an empty Config. Switch Shippit on under Settings › Shipping providers and fill in the key and service band there.

Is this a Shippit partnership?

No. The module calls Shippit’s public API with a key you supply. Shippit does not endorse GoCommerce, and no store is known to run this module in production yet.

Source

Everything on this page is read from ext/fulfill-shippit in the GoCommerce repository, MIT licensed. When this page and the code disagree, the code is right and this page is out of date.Shippit is a trademark of its owner; this module talks to its public API and implies no endorsement. See trademarks.

Try it against a store of your own

The one-command stack gives you GoCommerce’s API and admin on your own machine in minutes. Add this module to it and try it on test orders before a real one depends on it.

Chat on WhatsApp