# Shiprocket Shipping for GoCommerce — Open-Source Module

> Book Shiprocket shipments and waybills from a GoCommerce order: the API user, pickup location, parcel weights, COD, and what the module leaves out.

- Canonical: https://kitcommerce.store/integrations/fulfill-shiprocket/
- Last updated: 2026-09-25

---

Shipping

## Shiprocket shipping for GoCommerce

A Go package that books a parcel with Shiprocket, has a waybill assigned and asks for a label — all from the engine’s own fulfillment call. An API user, a pickup location and your variants’ weights are what it needs.

- **Shipping** module
- **7** settings
- **5** tests
- **ext/fulfill-shiprocket**

### What it does

Registering the module adds “shiprocket” as a fulfillment provider. An operator ships the usual way — the admin’s ship dialog, or POST /api/admin/create-fulfillment with "provider": "shiprocket" — and the module creates the order in Shiprocket, has a waybill assigned and asks for a label. The engine then stores the shipment, moves the order to shipped or partial, and writes the event; the module only talks to Shiprocket.

In the admin it describes itself as “Books shipments and waybills through Shiprocket, India’s aggregator: one login across its couriers.” Shiprocket assigns the courier unless the request names one.

What is declared is what is in the box. The engine works out which lines go in this parcel before the module is called, so the items, the declared value and whether the courier collects cash are this parcel’s, not the whole order’s.

### Configuration

Three settings are required: the API user’s email and password, and the pickup location’s nickname. Set them in Config from your own main(), or leave Config empty and fill them in under Settings › Shipping providers.

*Shiprocket module settings — 7 settings, 3 required*

| Setting | Environment variable | Required | What it does |
| --- | --- | --- | --- |
| `Email` API user email | `SHIPROCKET_EMAIL` | Yes | The login of the Shiprocket API user — the panel’s own note says the API user’s, not the account owner’s. |
| `Password` API user password | `SHIPROCKET_PASSWORD` | Yes | Exchanged for a bearer token, which the module caches for nine days; Shiprocket’s tokens last ten. |
| `PickupLocation` Pickup location | — | Yes | The nickname of the pickup address registered in Shiprocket. The package’s example uses “Primary”. |
| `DefaultWeightKg` Default weight (kg) | — | No | Per unit, for a parcel holding a variant with no weight recorded. 0.5 kg when unset; a fully weighed catalogue never reaches it. |
| `DefaultLengthCm, DefaultBreadthCm, DefaultHeightCm` | — | No | The box used when the engine has no single size — any parcel of more than one unit. 15 × 15 × 10 cm when unset. Go only. |
| `BaseURL` API base URL | — | No | Overrides https://apiv2.shiprocket.in, for tests. Empty for production. |
| `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. **Create an API user** — In Shiprocket, set up the API user the module will log in as, and note the nickname of the pickup address it should collect from.
2. **Install the module** — Import it and pass shiprocket.New to gocommerce.New, as below — or run the reference binary with -carriers, which installs every carrier module idle.
3. **Configure it** — Email, password and pickup location, in Config or under Settings › Shipping providers. Record weights on your variants; the default is only a fallback.
4. **Ship an order** — Choose Shiprocket in the admin’s ship dialog, or POST /api/admin/create-fulfillment with "provider": "shiprocket". The waybill becomes the tracking number.

main.go

```
import (
	"os"

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

app, err := gocommerce.New(cfg,
	shiprocket.New(shiprocket.Config{
		Email:          os.Getenv("SHIPROCKET_EMAIL"),
		Password:       os.Getenv("SHIPROCKET_PASSWORD"),
		PickupLocation: "Primary",
	}),
)
```

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

### How it works

- **Three calls per parcel**

  Create an ad hoc order in Shiprocket, assign a waybill, then generate a label. The waybill is returned as the shipment’s tracking number and the label URL is stored with it.

- **Outside the transaction**

  The carrier call runs before the engine opens its transaction, so a slow minute at Shiprocket never holds a lock on the orders table. The engine re-checks the order afterwards.

- **COD or prepaid, from the order**

  An order whose payment status is paid is booked as Prepaid; anything else as COD. Getting it wrong, the code notes, means a courier who does not ask for money or one who asks a customer who has paid.

- **Measured weight first**

  Three sources, in order: a figure passed in the request’s meta, the weight the engine summed from the variants — used only when every line was weighed — and the default per unit.

- **A new id per parcel**

  Shiprocket rejects a duplicate order id, so the first parcel goes as the order number and later ones as number-2, number-3 and so on.

- **Token cached, dropped on 401**

  The API user logs in once and the token is reused for nine days. A 401 clears it, so the next call logs in afresh.

### 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.

- **Half-booked parcels need a hand** — If Shiprocket creates the order but assigns no waybill, the call fails and names the shipment id. The engine records nothing, so finish or cancel that shipment in Shiprocket before retrying.
- **No tracking updates** — Nothing comes back after booking: no webhook, no polling. Marking an order delivered is a separate step, in the admin or through the API.
- **No rates, no cancellation** — The module quotes no shipping rates, and deleting a fulfillment in GoCommerce does not cancel it in Shiprocket.
- **Courier and box size need the API** — The admin’s ship dialog sends the provider, tracking and lines. A courier_id, or a box’s length, breadth, height and weight, go in the request’s meta, which only an API call sends.
- **Two-decimal money** — Prices are sent as minor units divided by 100 — right for rupees, wrong for a currency with none or three decimals.
- **The label is best effort** — If Shiprocket cannot generate a label, the shipment is still recorded, without a label URL. Print it from Shiprocket’s dashboard instead.

FAQ

### Questions about the Shiprocket module

**Who chooses the courier?**

Shiprocket, unless you do. Without a courier_id in the request’s meta the module asks Shiprocket to assign a waybill and Shiprocket picks; with one, it asks for that courier. The admin’s ship dialog sends no meta, so naming a courier is an API call.

**Which credentials does it need?**

An API user’s email and password — the module’s own note says the API user’s login, not the account owner’s — and the nickname of a pickup location registered in Shiprocket.

**What about cash-on-delivery orders?**

An order not marked paid is booked as COD, so the courier collects; a paid one is booked as Prepaid. Cash on delivery is GoCommerce’s default payment method, so an order taken without a gateway ships as COD.

**Does the order update when the parcel arrives?**

No. The module books and returns; it has no webhook and polls nothing. Mark the order delivered from the admin or with POST /api/admin/orders/{id}/deliver.

**Is Shiprocket a partner?**

No. The module calls Shiprocket’s public API with credentials you supply. Shiprocket 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-shiprocket`](https://github.com/itswadesh/gocommerce/tree/main/ext/fulfill-shiprocket) in the GoCommerce repository, MIT licensed. When this page and the code disagree, the code is right and this page is out of date.Shiprocket is a trademark of its owner; this module talks to its public API and implies no endorsement. See [trademarks](https://kitcommerce.store/about/#trademarks).

- [ext/fulfill-shiprocket on GitHub](https://github.com/itswadesh/gocommerce/tree/main/ext/fulfill-shiprocket)
- [Shiprocket](https://www.shiprocket.in)
- [All GoCommerce modules](https://kitcommerce.store/integrations/)

### 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.

[Deploy in minutes](https://kitcommerce.store/#one-command) · [Read the module](https://github.com/itswadesh/gocommerce/tree/main/ext/fulfill-shiprocket) · [All integrations](https://kitcommerce.store/integrations/)
