Overview
Integrate with Magento to import your orders, create shipment labels and show live DHL Express rates at your checkout.
The integration can also write back tracking information to these after printing your shipment labels.
There are two ways to connect your Magento2 store with DHL Express Commerce. Token based authentication is recommended especially if you are using two-factor authentication on your store.
As of Magento 2.4 two-factor authentication is enabled by default on Magento2. This means you will need to use token authentication to connect with DHL Express Commerce.
Magento 2.4.4 users will need to enable token access in the Admin by setting the Stores > Configuration > Services > OAuth > Consumer Settings > Allow OAuth Access Tokens to be used as standalone Bearer tokens option to Yes.
1. Set up access for DHL Express Commerce to Magento2
Token Authentication (recommended)
Create an access token.
- Log into your Magento2 admin page.
- At the very bottom left of the sidebar click System > Extensions > Integrations.
- Click Add New Integration.
- Enter DHL in the Name field.
- Enter your admin password in the Your Password field. Leave all other fields blank.
- Click the API tab.
- Under the Resource Access dropdown select All.
- Click Save in the top right of the screen.
- You will then be taken back to the Integrations page.
- Click Allow.
- A dialog will appear with a Consumer Key, Consumer Secret, Access Token, and Access Token Secret.
- Only the Access Token is required. Copy your Access Token and click Done.
User Authentication
Note: Skip this section if you have completed the steps above for Token Authentication
Create a new role
- Go to your Magento Admin Dashboard and select System.
- Under Permissions, select User Roles.
- Click Add New Role.
- In Role Name, enter Integration, then select the Role Resources tab.
- From the Resource Access dropdown, select All.
- Click Save Role.
Assign your new role to a user
- From the Dashboard panel, select System.
- Under Permissions, select All Users.
- From the Users page, click Add New User.
- Enter the required user information. We recommend you note your username and password for later use.
- Select the User Role tab, then select the Integration role you previously created.
- Click Save User.
2. Enter your Magento 2 details
- Log into DHL Express Commerce
- In your account select Settings, then select Integrations.
- Click Add a new integration, and select Magento 2.
- Select your Authentication Method from step 1.
- Click the Enable Magento 2 checkbox.
- Enter the URL of your site eg https://www.myShop.com
- Enter your Access Token or Username and Password.
- Select your Import status.
- Test your connection, and then click Save.
Troubleshooting
Error: "The Consumer isnt authorized to access %resources%"
If you encounter this error then navigate to
Stores > Configuration > Services > OAuth > Consumer Settings > Allow OAuth Access Tokens to be used as standalone Bearer tokens option to Yes
Additional Configuration
Importing HS Codes and Country Of Manufacturer
As these fields do not exist natively in the Magento system, custom product attributes have to be created so it can be imported into DHL Express Commerce.
- DEC will automatically import an HS Code for each item if present as a product attribute. The product attribute code name must be set to hs_code.
- DEC will automatically import Country of Manufacture for each item if present as a product attribute. The product attribute code name must be set to country_of_manufacture or country_of_origin.
-
Import Status
- Use this option to specify what status orders should be in to import into DHL Express Commerce. You can specify multiple values by separating each status with a semi colon.
-
Delivery information
-
Give your customers the option to choose between Signature on Delivery and Authority to Leave during the checkout process. To set this up, create the following custom fields:
delivery_comment (String max 100) for the delivery instruction
authority_to_leave: values can be 0, 1, true, false, yes or no
signature_required: values can be 0, 1, true, false, yes or no
NOTE: To add the file to /rest/V1/orders/ you need to add them to the order search Criteria API.
- Import Bundles
- By default DHL Express Commerce does not import Magento bundles. If you would like to enable this feature tick Import bundled items. This feature will allow writeback for orders which have bundle items in them.
Limitations: The bundle items will not display in the UI. They are only visible on the Customised packing slip - see this article for further information
Define a custom user-agent
Define a custom user-agent in the Magento 2 settings to make whitelisting much easier than maintaining a list of IP's through your firewall by going to Settings > Integrations > Magento 2 > User-Agent
Support differing address configurations
Supporting different address configurations with "Map Address Line 2 to building"
Import Single Order feature
- Import single orders with the new tool in Settings > Integrations > Magento 2 >
Tools > Import Orders