EMDI issues and cancels courier vouchers by calling the script you set in the courier.ini file (EMDI main folder / courier settings).
On the document shipping method, fill in the company abbreviation (courier), user, password and sender id. Open a sales document and press the voucher button: if the voucher field is empty, EMDI creates; if it already has a number, it opens the status window (print/cancel). Right-click the button to choose the sender company name, whether to send items, and which address tab supplies the recipient (customer/shipment/consignee).
Before the call, EMDI checks address+city/area, ZIP, courier details and weight > 0 (sum of item lines; if volume/area exists, it uses the greater of weight and volumetric weight = area/5000).
Special document phrases for voucher issuance
In the document lines, where the unit of measurement is specified as an additional field, EMDI reads the description and sends parameters to the Courier API when issuing the voucher.
| Phrase (exact / prefix) | Usage when printing voucher | API parameter |
DELIVERY SATURDAY |
Enables Saturday delivery. | saturday=1 |
SPECIAL MANAGEMENT |
Exact title → special=1. If the description contains the phrase plus more text, the remaining text is sent. |
special |
PAY ON DELIVERY or COST OF PAYMENT |
Treats COD as the document total (together with the check_payment rule). |
cashondelivery |
SHIPPING PACKAGES |
Line quantity = number of packages. Extra text after the phrase → qty*text. |
quantity |
RECEIVING FROM COURIER OFFICE |
Pickup from courier shop. | office=1 |
RECIPIENT BILLING FOR SHIPPING CHARGES |
Recipient billing. | recipientbilling=1 |
LOCKER: code |
Locker code (e.g. Box Now / Skroutz Point). Example: LOCKER: 11474. From e-shop bridge when VOUCHER is |code (empty voucher number). |
locker |
TRANSPORTATION COST |
Shipping-cost value line (from e-shop order / document). No separate query flag. | — |
Sample courier.ini:
|
1 2 3 4 5 6 |
[general] temp=https://www.sbzsystems.com/apps/emdi/tmp/ script=https://www.sbzsystems.com/apps/emdi/courier.php pdf_software= pdf_attributes= check_payment=1 |
script = base call URL. temp = PDF folder URL (EMDI downloads {courier}_{voucher}.pdf). Optional pdf_software / pdf_attributes for local printing. With check_payment=1, if the document is unpaid, COD equals the total; otherwise 0 (unless a COD line exists).
Label printing no longer reads a per-company [print] section: after create it always calls {script}?action=print+abbreviation+&voucher=…&cppass=…. A local exe may still use placeholders:
| Placeholder | Description |
#senderid |
Sender code |
#courieruser/#courierpass |
Courier login |
#cpuser/#cppass |
App user/password |
#voucherno |
Voucher number |
Endpoints
| Method | Name | Example |
| POST | print (create) |
{script}?…&action=print&… + form body |
| GET | view |
{script}?…&action=view&… |
| GET | cancel{courier} |
…&action=cancelspeedex&… |
| GET | print{courier} |
{script}?action=printspeedex&voucher=… |
Create = POST hybrid (parameters in the URL + body company_data, products, optional pdf). Open/cancel/label print = GET. For ELTA, print/cancel buttons in the voucher window are hidden.
Response: voucher_number|message. If the number is missing (or contains a line break), EMDI shows the message after | and stops.
| Query | Description |
courier |
Abbreviation (speedex, acs, elta, dhl, …) |
rec_date |
Ship date yyyymmdd (delivery day or document date) |
courieruser/courierpass |
Login details |
cpuser/cppass |
App user/password |
senderid |
Sender code |
rec_* |
Recipient: name, company, floor (PO box), address, area+city, ZIP, phone, mobile, email, country |
quantity |
Packages (default 1; from “SHIPPING PACKAGES” line) |
weight |
Calculated weight |
notes |
Document notes (# → space) |
cashondelivery |
COD (see check_payment/lines) |
relateddoc |
Document series + number |
sendername |
Sender company name (company or menu choice) |
action |
Always print |
emdiuser |
EMDI license username |
saturday |
DELIVERY SATURDAY: 1/0 |
exact |
Time HH:nn or HH:nn-HH:nn if fields Delivery from and Delivery to are filled in |
special |
Special handling (1 or text after the title) |
office |
Pickup from shop: 1/0 |
recipientbilling |
Charge recipient: 1 or empty |
locker |
Locker id from LOCKER: code line |
POST body (form fields):
| Field | Description |
company_data |
EMDI company data: address|ZIP|city|country|phones|VAT |
products |
Item lines if “products on voucher” is on or courier=dhl. Per line: code|description|qty|total_incl_VAT|weight and optional |taric; line end \n. For DHL with products it starts with _. |
pdf |
Base64 invoice PDF — required for DHL outside the EU (recipient zone ≠ EU); otherwise omitted if no file exists. |
Called when a voucher number already exists. EMDI opens the link and shows the HTML in the voucher window.
From the view URL it replaces action=view with action=cancel + abbreviation (e.g. cancelspeedex). Not plain action=cancel. Then it clears the voucher field on the document.
After a successful create, EMDI calls this link, downloads the PDF to files\vouchers\{courier}_{voucher}.pdf, and if a PDF program is set it prints it.
Otherwise it opens the print URL directly.
Sample PHP (each company has its own include):
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 |
<?php require_once('courier_common.php'); $couriername = $_GET['courier']; $action = $_GET['action']; // … read the other query fields the same way … // On create, also read POST: pdf, company_data, products if ($couriername == 'speedex' || $action == 'printspeedex' || $action == 'receiptspeedex' || $action == 'cancelspeedex') { require_once('courier_speedex.php'); } // Create success response (plain text): // echo $voucher_code . '|' . $message; |
The response format must be voucher|message so EMDI can store the number on the document.
