Guides
How to Add Package Tracking to a Dropshipping Store
Track YunExpress, 4PX, Cainiao, and ePacket orders in a dropshipping store: carrier auto-detection, supplier delays, and delivery notifications.
Dropshipping tracking is harder than domestic e-commerce for one reason: the carriers. A single store might receive YunExpress, 4PX, Cainiao, ePacket, and China Post numbers, each with a different format, and the customer just sees a tracking number with no idea which carrier to check.
The fix is carrier auto-detection plus a normalized timeline. This guide shows how to add tracking to a dropshipping store so customers see one consistent status page regardless of which logistics line actually carried the parcel.
Why dropshipping tracking is different
Dropshipping parcels change hands several times — a first-mile courier, an export line, a destination postal operator — and each leg may scan under a different identifier. Tracking numbers use prefixes like YT (YunExpress), LP or CAIN (Cainiao), 4PX, and LX/LY/LZ (ePacket).
Detecting which carrier a number belongs to is the first problem, and getting it wrong sends the customer to the wrong tracking page. That is why auto-detection is the core requirement for any dropshipping tracking layer.
Auto-detect the carrier
A tracking API that recognizes common dropshipping prefixes saves you from asking suppliers which carrier they used — which they often do not answer consistently. Send the raw number, let the API infer the carrier, and return a normalized status.
For ambiguous or unknown formats, accept an explicit carrier code as an override. The point is that the common case — YunExpress, Cainiao, 4PX, ePacket — works without any per-supplier configuration.
A minimal integration
Send the supplier's tracking number without a carrier and let the API detect it. The response gives you the detected carrier and a normalized status you can render anywhere.
Store the result against the order so the customer's status page reads from your own database.
// YunExpress, 4PX, Cainiao, ePacket — no carrier code needed.
const response = await fetch("https://api.traceapi.dev/v1/track", {
method: "POST",
headers: {
Authorization: "Bearer " + process.env.TRACE_API_KEY,
"Content-Type": "application/json",
},
body: JSON.stringify({ tracking_number: "YT2213421266060000" }),
});
const tracking = await response.json();
console.log(tracking.carrier.code, tracking.status);Handle supplier delays honestly
The tracking number may exist days before the carrier scans the parcel, so a quiet status does not always mean a problem. Show the last known event and its timestamp, and distinguish no-new-scan-yet from lookup-failed.
Never invent progress. A customer is far more patient with label created, awaiting carrier pickup than with a status page that quietly fills in fake movement.
Notify on delivery, not on every scan
Webhooks for tracking.delivered and tracking.exception let you email the customer exactly when it matters, instead of spamming them at every intermediate hop. Verify the webhook signature and deduplicate on the event id.
Delivery is the event your customer actually cares about; everything else is reassurance.
What to watch for
Watch for numbers that change carrier mid-journey, suppliers that reuse tracking numbers, and destination-leg scans that appear under a local postal operator. A normalized layer absorbs most of that; your code should still treat the carrier as a hint, not a guarantee.
The payoff is a store that shows the same clean tracking experience for a YunExpress parcel, a 4PX parcel, and a Cainiao parcel — which is exactly what dropshipping customers expect.
Useful next steps
Build tracking into your product
Create a Trace account, generate an API key, and test package tracking from the dashboard.