Shipping

India Post consignments for GoCommerce

A Go package that records a parcel you booked at the post office counter or in the Department of Posts’ portal, and refuses a consignment number India Post did not issue. It books nothing, and its own documentation says so.

What it does

Registering the module adds “india-post” as a fulfillment provider. An operator ships the usual way — the admin’s ship dialog, or POST /api/admin/create-fulfillment with "provider": "india-post" and the consignment number from the receipt — and the module checks the number, records the carrier as India Post and hands the shipment to the engine.

The package doc is candid about why it stops there. Every other fulfillment module calls an API and gets a waybill back; India Post has no such API that a store can sign up for. The Department of Posts integrates bulk customers one at a time, under an agreement, with no public sandbox and no documented request body — so a module that claimed to book a shipment would be guessing at somebody else’s contract.

What it does instead is the part that can be done correctly: take the number, check that it is an India Post article number before the order is marked shipped — which catches the transposed digit that would otherwise surface a week later as a customer with a dead link — and record the carrier, so the number is never attributed to anyone else.

Configuration

One setting, and nothing required. Because it needs no credentials, the module starts switched on as soon as it is installed; the setting lives in Config or under Settings › Shipping providers.

India Post module settings — 1 setting, 0 required
SettingEnvironment variableRequiredWhat it does
AcceptAnyNumber
Accept any consignment number
— No Turns off the S10 check, for an India Post product that numbers differently. Off by default: the number must be a 13-character S10 barcode.

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. Book at the counterHand the parcel over at a post office, or book it in the Department of Posts’ own portal, and keep the consignment number from the receipt.
  2. Install the moduleImport it and pass indiapost.New to gocommerce.New, as below — or run the reference binary with -carriers. It needs no keys, so it starts switched on.
  3. Record the parcelChoose India Post in the admin’s ship dialog and type the number, or POST /api/admin/create-fulfillment with "provider": "india-post" and the tracking number.
  4. Let the check workA number that is not an S10 article number — EE123456789IN for Speed Post — is refused, and the order stays unshipped until the right one is entered.

main.go

import (
	"github.com/itswadesh/gocommerce/core"
	indiapost "github.com/itswadesh/gocommerce/ext/fulfill-indiapost"
)

app, err := gocommerce.New(cfg, indiapost.New(indiapost.Config{}))

The package doc’s own example, with its imports; cfg is your gocommerce.Config. An empty Config is the normal case. Import path github.com/itswadesh/gocommerce/ext/fulfill-indiapost.

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 India Post module

Why does it not book shipments like the other carrier modules?

Because there is nothing public to book against. The package doc explains that India Post has no API a store can sign up for: the Department of Posts integrates bulk customers one at a time, and the endpoint, credentials and payload are issued under that agreement rather than published.

What does a valid consignment number look like?

Thirteen characters on the UPU S10 standard: two letters, nine digits and IN — EE123456789IN for Speed Post, RX… for registered, CX… for business parcels. Spaces, hyphens and lower case are cleaned up before the check.

My product’s number does not match. What now?

Switch on Accept any consignment number (AcceptAnyNumber in Config). The number is then recorded as typed, cleaned of spaces and hyphens, without the check.

Does it need credentials?

None. Its one setting is optional, so it starts switched on as soon as it is installed, and it makes no network calls.

Is India Post involved?

No. The module calls no India Post system and records numbers you type. India Post 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-indiapost in the GoCommerce repository, MIT licensed. When this page and the code disagree, the code is right and this page is out of date.India Post is named here only to identify the carrier; this module calls no India Post system 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