
Magento Shipping Integration: From API to Customs
Magento shipping integration means, specifically, that label generation, tracking, and shipment status run automatically from within the shop, controlled via the Magento REST API or a carrier module. There are various approaches to the technical implementation. Magento REST API (approximately POST /V1/order/{orderId}/shipThis is suitable if you need full control over the logic and want to connect it to an ERP system. native carrier module like DHL Shipping (Dhl_ShippingThis is sufficient for retailers with one primary shipping provider. Multi-carrier middleware It becomes worthwhile as soon as multiple shipping providers, customs calculations and paperless trade come together.
Before every integration, a quick check is performed:
- Check master data: Weight, dimensions, customs tariff number and value of goods must be correctly entered for each product.
- Set up a sandbox environment and keep it cleanly separated from the live environment.
- Manage API access data (Bearer Token or OAuth) and carrier credentials separately.
We support you every step of the way to find the right solution for your business.
Key insights
A functioning Magento shipping integration stands or falls with clean master data, the right technical route and consistent sandbox tests before the live rollout.
| Theme | Details |
|---|---|
| Choose the correct route | REST API for ERP integration, carrier module for a main shipper, middleware for multiple shipping service providers. |
| Master data first | Weight, dimensions, HS code and merchandise value must be correctly entered before any automation. |
| Strictly separate the sandbox | Never mix live and test access data; this is the most common source of errors. |
| Plan for monitoring | Continuously monitor error logs, carrier response times, and alarm rules, not just during rollout. |
| Automation via International Parcel | The platform automatically calculates customs duties and shipping costs and centrally connects Magento with all common parcel services. |
Table of Contents
- Quick Start Checklist: Go live in 6 steps
- Which technical integration option is right for your shop?
- How do developers technically configure the shipping API?
- Why does automatic customs calculation fail due to poor master data?
- How do you test the shipping integration before rollout?
- Parcel International as a way to automated shipping integration
- Sources
Quick Start Checklist: Go live in 6 steps
The order determines whether the integration runs smoothly or you spend days searching for errors.
- Check master data (Ops): Fully maintain weight, dimensions, HS codes and merchandise value for each product.
- Configure sandbox (Developer): Activate the DHL sandbox or API test environment before going live with anything.
- Activate API or module (Developer): Either connect the Magento REST API or activate the Carrier module in the Admin under Stores → Configuration → Sales → Delivery Methods.
- Conduct test orders (Shipping, Ops): Simulate multiple order scenarios including partial shipping.
- Check logging (Developer): Check error logs and API response times before the rollout begins.
- Go live (Ops, developers together): Switch access data from Sandbox to Live and closely monitor the first real broadcasts.
Pro tip: The most common source of errors is not a faulty configuration, but a mix of sandbox and live credentials. Before rolling out the system, explicitly check which credential pair is currently active.
Which technical integration option is right for your shop?
The Magento REST API provides access via the Shipments resource. /V1/shipment Endpoints are provided for creating and retrieving shipments, including tracking data and authentication via bearer token or OAuth. This approach is suitable if you have an existing ERP integration or want to program your own shipping rules. It requires more development effort, but in return, you gain full control over every step of the shipping process.

A native Carrier module The Magento_Dhl module is quicker to set up in the admin panel. Adobe Experience League recommends setting the DHL type to "DHL REST" during configuration, as the older XML interface is considered obsolete. Sandbox mode and separate API credentials are mandatory here, not optional.
For retailers with multiple shipping providers, it is often worthwhile to consider one Multi-carrier middlewareIt bundles shipping options from DHL, UPS, FedEx, DPD or DB Schenker into one interface and handles landed cost estimation and paperless trade centrally, instead of maintaining this information individually for each carrier.
The decision depends on four criteria:
- Implementation effortAPI integration requires developer resources; configuring a module takes hours.
- MaintainabilityMiddleware handles carrier updates centrally; you must maintain your own API integrations yourself.
- Real-time ratesNot every module provides prices accurate to the day; middleware solutions usually do so more reliably.
- Custom functionsAnyone who ships a lot internationally needs landed cost calculation and customs documents automatically in the checkout.
How do developers technically configure the shipping API?
The central endpoint for program creation is POST /V1/order/{orderId}/ship, Loud Adobe Commerce Documentation Does it accept a JSON payload with items, notify and tracks. In tracks-Array you pass carrier_code, title and track_number, in the items-Array the respective order_item_id with the quantity shipped. A successful request can automatically set the order status to "Complete".
For bundled products, the top-level order_item_idFor partial deliveries, only specify the items actually shipped. This is particularly relevant for international shipments if an item is delivered later due to stock issues.
Three authentication methods are available: an admin token (bearer) for internal integrations, OAuth 1.0a for third-party applications, and restricted guest access for individual public endpoints. For most Magento shipping integrations, the admin token is sufficient.
In the admin panel, activate the DHL carrier under Stores → Configuration → Sales → Delivery Methods and enter the API key and API secret for DHL REST. A DHL module for Magento 2 can be installed via Composer, followed by... bin/magento module:enable Dhl_Shipping, subsequent setup:upgrade, cache:flush and di:compile.
- Hooks for label generation should be triggered with every Shipment Create.
- An event listener logs errors separately from successful calls.
- Retry mechanisms with exponential backoff prevent a short-term carrier failure from blocking the entire transmission.
Pro tip: Strictly adhere to the configuration sequence: first set up the shipper account, then enter addresses, then define package sizes, and only lastly activate shipping methods. Reversing this order will create silent errors that will only become apparent with the first actual shipment.
Why does automatic customs calculation fail due to poor master data?
Without accurate product data, automatic customs calculation is impossible. Weight and dimensions must be exact, as must the customs tariff number (HS code) and the actual value of the goods. If any of this information is missing, the Customs tariff number It cannot be automatically assigned, and the shipment gets stuck in customs.
Many retailers underestimate how crucial the quality of master data (via https://paket-international.com/zolltarifnummer-bestimmen) is for the entire automation process. Without accurate weight and dimension specifications, as well as precise HS codes, neither automatic customs calculation nor reliable label generation is possible.
For international shipments, additional requirements apply: Paperless Trade transmits customs documents electronically instead of in paper form, a Landed Cost estimate shows the buyer customs duties and taxes at checkout, and EORI and VAT information must be included in the shipping documentation.
Specifically, a clean master data database includes:
- Precise weight and dimension specifications per item, no estimates.
- Correct customs tariff numbers for each product category.
- The actual value of the goods for the commercial invoice, not a flat average value.
- EORI number and VAT ID for customs clearance.
Incorrect HS code assignments regularly lead to customs delays and unexpected additional costs. Systematically validating product data before the integration goes live saves precisely this rework during operation.
How do you test the shipping integration before rollout?
You should run through four test cases before every live launch: the rate display in the checkout, the label creation itself, the handover of the tracking number to the customer, and the handling of partial shipments or returns.
- Perform checkout rate checks with different destination countries and package sizes.
- Test label creation in sandbox mode without triggering a real booking with the carrier.
- Check tracking handover to the customer, including order status changes.
- Simulate partial shipping, where only a portion of the ordered items are shipped.
For ongoing operations, a fixed monitoring system is needed:
- Daily monitoring of error logs and failed API calls.
- Monitoring carrier response times to detect failures early.
- Clear alarm rules that automatically trigger a notification in case of repeated shipping errors.
A rollback plan is also part of the plan: In case of critical errors, deactivate the module and switch to a fallback shipping rule instead of completely blocking the checkout.
Parcel International as a way to automated shipping integration
Anyone wanting to program the REST API themselves or maintain a single carrier module invests developer time that many retailers simply don't have to spare. Paket International connects Magento with all common shipping providers via a central integration, instead of maintaining separate modules for DHL, UPS, FedEx, DPD, and DB Schenker.
The platform calculates shipping costs and customs duties in seconds, automatically generates shipping labels, and handles customs clearance without manual intervention. For online retailers with international business, this significantly reduces administrative effort. A central dashboard displays all shipments at a glance, including... Shipment Tracking across all parcel services.
Especially for online retailersFor those who currently maintain individual carrier modules and still manually fill out customs documents, this represents a direct time saving: Landed cost, customs paperwork, and label creation run automatically, without you having to program additional middleware logic yourself. If you want to explore how your existing Magento shipping integration can be replaced or supplemented, it's worth taking a look at the Magento integration of Paket International and a non-binding offer for your shipping volume.