Developer Guide

Connecting Your Store or Software to ApnaCourier

Whether you run a Shopify store, a WooCommerce site or your own order system, there is a way to stop copying orders by hand. This guide helps you choose one and roll it out safely.

Three ways to connect

ApnaCourier offers three integration routes. They share the same account, wallet and shipments, so you can start with one and add another later without moving data.

Whichever route you pick, the operational rules stay the same. Freight and COD fees come from the prepaid wallet at booking, pickups follow the same cut-off, and every shipment appears in the panel, so staff who prefer the screen can still see and act on orders that arrived through code.

  • Shopify app: orders from your Shopify store sync into ApnaCourier, and tracking details are written back to the Shopify order once you ship.
  • WooCommerce plugin: installs on your WordPress site and connects WooCommerce orders to your ApnaCourier account.
  • REST seller API: for custom websites, apps, order management systems and ERPs, with live and test keys, webhooks, an OpenAPI specification and a Postman collection.

Choosing the route that fits

The right choice depends less on order volume and more on where your orders live and who will maintain the connection.

If your store runs on Shopify, the app is the natural starting point and needs no code; the Shopify shipping guide walks through it. WooCommerce sellers should begin with the plugin, covered in the WooCommerce shipping guide. Choose the API when orders come from a platform without a ready-made connector, when you sell through several channels and consolidate orders in your own system, or when you want shipping actions to happen inside software your team already uses.

A common pattern is to use the app or plugin for the storefront and the API for internal tools, such as a dashboard that pulls COD and charge data into your accounts.

Building on the seller API in a sensible order

Most integration problems come from building everything at once. Working through the API in stages keeps each step testable and makes it obvious where something breaks.

  • Create test keys and import the Postman collection, so you can make your first calls without writing any code.
  • Read the OpenAPI specification and generate a client in your language if your tooling supports it.
  • Start with rate checks and serviceability, which have no side effects.
  • Add shipment creation and label download, using test keys until the request data is right.
  • Add the NDR actions: reattempt, update address or phone, and return to origin.
  • Subscribe to webhooks and update your own order records from them.
  • Switch to live keys only after the full flow has passed with test keys.

Webhooks worth listening to

Polling for status changes wastes requests and still leaves you behind. Webhooks push events to your server as they happen, and ApnaCourier sends them for four families of events.

  • Shipment events: use them to update order status, notify the customer and open an NDR task when an attempt fails.
  • COD events: use them to mark collections as settled in your books.
  • Charge events: use them to record wallet debits such as weight discrepancy and return charges against the right order.
  • Payout events: use them to match COD withdrawals to bank credits.

Writing webhook handlers that hold up

Any webhook system can deliver an event more than once, or deliver two events in an unexpected order. Design your handler so that processing the same event twice does no harm, for example by storing the event identifier and skipping ones you have already seen.

Reply quickly and do heavy work, such as sending emails or updating several tables, in a background job. Log the raw payload of every event for at least a few weeks; when a customer disputes a delivery or a charge looks wrong, that log is the fastest way to see what actually happened. Finally, never trust a status alone for money decisions: when an event affects a refund or a payout, confirm it against the shipment record before acting.

Keeping your API keys safe

A live key can book real shipments that are paid from your wallet, so treat it like a password. Keep it on your server, in environment variables or a secrets manager, and never place it in browser code, a mobile app or a public code repository.

Give test and live keys clearly different names in your configuration so nobody points a staging server at your live account by mistake. If a key may have been exposed, stop using it straight away and contact support@apnacourier.com.

A go-live checklist

Before switching your integration to live keys, run through the full life of a few orders end to end. The shipping API integration article has further background on designing the flow.

  • Prepaid and COD orders both create shipments with the correct amounts.
  • Weights and dimensions are sent in the units the API expects.
  • Labels download and print correctly on your printer.
  • A simulated failed delivery reaches your NDR process.
  • Webhook handlers survive a repeated event without double updates.
  • Error responses are logged and shown to staff in plain language.

Frequently Asked Questions

Start Shipping Smarter Today

Join thousands of Indian businesses using ApnaCourier to save time and money on logistics.

View Pricing