Skip to content


Switch branches/tags
This branch is 20 commits behind waldher:master.

Latest commit


Git stats


Failed to load latest commit information.
Latest commit message
Commit time


This is a simple gem to wrap the DHL Intraship SOAP Api. Note that currently only "national day definite shipment" usecases are implemented (Sending, deleting and manifesting national day definite packages without any extra services.) Booking a pickup is implemented as prototype, but not yet supported by DHL itself.


Add this line to your application's Gemfile:

gem 'dhl-intraship'

And then execute:

$ bundle

Or install it yourself as:

$ gem install dhl-intraship


Initialize a new API object using

api =, options)

Config is the following hash:

config = {user: 'your Intraship API user name', #mandatory
          signature: 'Your Intraship API user password', #mandatory
          ekp: 'Your DHL EKP (first part of your DHL Account number)', #mandatory
          procedure_id: 'The prodedureId (second part of your DHL Account number)', #optional, defaults to '01'
          partner_id: 'The partnerId (=attendance, third part of your DHL Account number)' #optional, defaults to '01'

Options is an optional parameter and can contain the following parameters:

options = {test: true, # If test is set, all API calls go against the Intraship test system
           label_response_type: :xml} # If it's set to XML the createShipment-Calls return the label data as XML instead of the PDF-Link

Create a shipment

To create a shipment to DHL you need to create it first

sender_address = 'Team Europe Ventures',
                                                    contact_person: 'John Smith',
                                                    street: 'Mohrenstraße',
                                                    house_number: '60',
                                                    zip: '10117',
                                                    city: 'Berlin',
                                                    country_code: 'DE',
                                                    email: '')
receiver_address = 'John',
                                                     lastname: 'Doe',
                                                     street: 'Mainstreet',
                                                     house_number: '10',
                                                     street_additional: 'Appartment 2a',
                                                     zip: '90210',
                                                     city: 'Springfield',
                                                     country_code: 'DE',
                                                     email: '')
#Note that the weight parameter is in kg and the length/height/width in cm
shipment = sender_address,
                                        receiver_address: receiver_address,
                                        weight: 2,
                                        length: 30,
                                        width: 25)

Beware, that due to DHL Intraship restrictions, the sender address must be a CompanyAddress and requires a contact_person. The actual api-call takes an array of shipments, or a single shipment. The result contains the "shipment_number", as well as the "label_url" (or the "xml_label" when it was specified as repsonse type)

result = api.createShipmentDD(shipment)
shipment_number = result[:shipment_number]
label_url = result[:label_url] # Or result[:xml_label] in case XML label was set in the options

Add cash on delivery

For the "cash on delivery" service you need to create a Bankdata object with the payee information. Give that together with the amount and the currency to a CODService object. Finally add the service to your shipment:

bankdata = 'John Smith',
                                        account_number: '1212121212',
                                        bank_code: '12345679',
                                        bank_name: 'Testbank 2',
                                        note: 'OrderID 12345')
cod_service =  15.00,
                                             currency: 'EUR',
                                             bankdata: bankdata)

Delete a shipment

You can create and delete shipments as much as you like, they will not get into the "real" DHL system until you manifest them. To delete a shipment call deleteShipmentDD with the shipment number for a non-manifested shipment:


Manifesting a shipment

A shipment created in Intraship is only transferred to the "real" DHL systems after the shipment is manifested. If "manifestShipment" is not called manually, it should be automatically manifested after the time that is configured in the Intraship backend. To manifest the shipment manually call:


Note that the label has to be downloaded at least once, or Intraship will reply with status code 2030: shipment not printed

Booking a pickup

The "book pickup"-call is defined in the Intraship API and also supported in this gem, but not implemented and supported in Intraship itself

The API will complain if no "contact orderer" is specified, although it's supposed to be optional. Furthermore issuing a "book pickup" call will yield a "Please select a product in the shipment details." (1102) error, although the call is completely valid.


  1. Fork it
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Added some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create new Pull Request


A very basic wrapper for the DHL Intraship SOAP interface







No packages published


  • Ruby 100.0%