Back to Blog
Web Development

Shipping Carrier Integration for E-Commerce (2026)

How shipping integration actually works: carrier APIs, multi-carrier aggregators and ready-made modules compared, plus label, tracking and return flows, real costs and the mistakes that break orders.

E-ticaretEntegrasyonKargoWeb Geliştirme

Shipping integration connects your e-commerce store to a carrier’s system so that creating a shipment, generating the label, pulling the tracking number and notifying the customer all happen automatically. There are three ways to do it: connect directly to a single carrier’s API, use a multi-carrier aggregator that puts many carriers behind one interface, or switch on the ready-made module in your e-commerce platform. For a store working with one carrier, a direct API integration is typically 3-10 working days of development; if you ship with two or more carriers, an aggregator is almost always cheaper. Below: how the three paths differ, what a carrier API actually gives you, what it costs per shipment, and the mistakes that quietly break orders.

What shipping integration actually solves

Without integration, every order takes the same manual path: export the order list, retype it into the carrier’s web panel, print the label, copy the tracking number back into the order record, then email the customer. At 10 orders a day that is roughly half an hour. At 100 orders a day it is a full-time job — and typos start sending parcels to the wrong address.

Integration collapses that chain into one click. When an order moves to “ready to ship”, the system opens the shipment, produces the label as a PDF, writes the tracking number to the order record and notifies the customer. Because carrier status updates flow back in, “where is my parcel?” tickets largely disappear — usually the single biggest category of support volume in a growing store.

Three integration paths: which one fits you?

  • The carrier’s own API — Every major carrier offers API access to contracted accounts. This gives you the lowest per-shipment cost because nobody sits in the middle. The trade-off: field names, error codes and documentation quality differ wildly between carriers, so adding a second one means writing the integration again.
  • A multi-carrier aggregator — One API that opens shipments across dozens of carriers, usually with rate shopping, automatic carrier selection and unified tracking. It charges a small per-shipment fee or a monthly plan. For any store shipping with two or more carriers this is the most efficient route by a wide margin.
  • A ready-made platform module — On Shopify, WooCommerce and similar platforms, shipping is often a plugin you install in an afternoon. The limit is customisation: if you need your own rules — carrier by parcel size, different carrier by region, multi-piece shipments — the module runs out of room quickly.

The decision rule is simple: one carrier and a standard flow means a direct API or a module; multiple carriers, multiple warehouses or your own business rules mean an aggregator. If you are building a custom store, make this choice at the start of the architecture — swapping the shipping layer later also changes your order model. We broke down how these choices land in the budget in our guide to the cost of building an e-commerce site.

What a carrier API really gives you

A shipping API looks like one service on the marketing page, but in practice it is five separate capabilities — and not every carrier ships all five. Ask about each one before you sign:

  • Shipment creation — Opens a record from recipient details, address, weight/volume and payment type, and returns a tracking number.
  • Label generation — A printable label as PDF or ZPL. If you use a thermal printer, confirm ZPL support explicitly; making a PDF print correctly on thermal hardware is its own project.
  • Tracking lookup — Current status for a tracking number. Two models exist: you poll on a schedule, or the carrier pushes a webhook on change. Prefer webhooks; polling is both delayed and wasteful.
  • Cancellation and returns — Cancelling an open shipment and issuing a return code. This is usually the weakest part of a carrier API, and you may end up handling returns manually.
  • Rate quoting — Calculating the fee up front from size and distance. If you want to show real shipping costs in the cart, this endpoint is mandatory.

A typical create-shipment call looks like the snippet below regardless of platform. Run it server-side and never let the API key reach the browser:

// app/api/shipments/route.ts — server side, the key never reaches the client
export async function POST(request: Request) {
  const order = await request.json();

  const response = await fetch('https://api.carrier.com/v1/shipments', {
    method: 'POST',
    headers: {
      Authorization: `Bearer ${process.env.CARRIER_API_KEY}`,
      'Content-Type': 'application/json',
      // Stops a retried request from opening a second shipment
      'Idempotency-Key': order.id,
    },
    body: JSON.stringify({
      receiver: {
        name: order.customer.fullName,
        phone: order.customer.phone,
        address: order.shippingAddress.line1,
        city: order.shippingAddress.city,
        district: order.shippingAddress.district,
      },
      parcel: { volumetricWeight: order.desi, pieceCount: order.pieceCount },
      paymentType: order.isCashOnDelivery ? 'RECIPIENT' : 'SENDER',
    }),
  });

  if (!response.ok) {
    // Log the body: carrier APIs sometimes return errors inside a 200
    const detail = await response.text();
    return Response.json({ error: 'CARRIER_ERROR', detail }, { status: 502 });
  }

  const { trackingNumber, labelUrl } = await response.json();
  return Response.json({ trackingNumber, labelUrl });
}
The Idempotency-Key header is the most important line in that request. A request retried after a network timeout will, without it, open a second shipment for the same order — two parcels go out to the customer and you pay for both. If your carrier does not support the header, build the same protection yourself: make the shipment record unique per order number.

Cost: build once, then pay per shipment

There are two separate cost lines and confusing them wrecks budgets. First, the one-off build: a direct carrier API integration is typically 3-10 working days, an aggregator integration 2-5 working days, and a platform module a few hours. Second, the running cost: the carrier charges per shipment according to your contract, and an aggregator adds a small per-shipment fee or a monthly plan on top.

In contract negotiations only one thing moves the number: volume. Unit price falls as monthly shipment count rises, which means renegotiating once a year saves more money than any optimisation in the integration itself. If you are wiring up payments and invoicing at the same time, our guides to payment integration and e-invoice integration explain how the three fit together.

Five mistakes that break shipping integrations

  • Squeezing the address into one free-text field — Carriers match city and district against their own code lists. A system that tries to parse a district out of free text trips over spelling and punctuation variants. Collect city and district as separate, selectable fields at checkout.
  • Ignoring volumetric weight — Shipping is usually priced on volumetric weight, not actual weight. If your product records do not store width, height and depth, the fee you show in the cart will not match the one on your invoice.
  • Staying silent on errors — Carrier APIs sometimes return an error inside an HTTP 200 body. An integration that only checks the status code will mark the order “shipped” when no shipment exists, and you will hear about it from the customer.
  • Not syncing tracking status — Writing the tracking number once is not enough. Stores that never write delivered, failed-delivery and returned statuses back to the order record end up tracking returns by hand.
  • Putting the API key in the client — Making carrier calls from the browser exposes the key in the network tab to anyone who looks. All carrier calls belong on the server. We collected this and other enterprise integration patterns in what API integration is.

Pre-integration checklist

  • Sign the carrier contract and request API access (test and live keys) — this step usually takes longer than the development itself.
  • Add width, height, depth and weight fields to your product records; volumetric pricing depends on them.
  • Make city, district and neighbourhood selectable fields at checkout.
  • Open at least one shipment in the test environment, print the label on the real printer and try the cancellation flow.
  • Enable webhooks for tracking status if the carrier offers them; if not, set up a scheduled sync job.

Conclusion

Shipping integration is not technically hard; the difficulty is choosing the right path and thinking through the edge cases — addresses, volumetric weight, errors and returns — before you write code. One carrier means a direct API is cheapest; several carriers mean an aggregator is fastest. If the same orders also arrive from marketplaces, remember the label comes from their side; we covered that in marketplace integration for e-commerce. If you want to talk through which setup suits your store, take a look at our web development service or request a quote.

Let's Build Your Project

Get a free consultation for your website, mobile app, or corporate software project.

Get a Free QuoteExplore our Web Development service