pixiGetOrderHeadersForCustomer
Returns the order headers of a customer, identified by customer key or by external customer number or e-mail, with payment, voucher and shipping data.
Returns one row per order (OrderHeader) of a customer, sorted by OrderDate descending.
Customer selection
- If
CustKeyis not0, only orders withCustRef = CustKeyare returned.CustomerNrExternalandShopIDare ignored in this case. - If
CustKeyis0(default), orders of all customers whoseCustomerNrExternalor e-mail address (CeMail) equalsCustomerNrExternalare returned. IfShopIDis given, the customer must also belong to that shop (CustomerOf). An emptyShopIDis treated asNULL(no shop filter).
Further filters
OrderDateFrom: only orders withOrderDateon or after this value.NULLor empty means1900-01-01.OrderStatus:OPEN,HOLDorCLOSEDfilters on the order status. Any other value (orNULL) disables the status filter.
Returned data per order
- Header data such as order number, external order number, totals, ship cost, shop note, address remarks and currency code (
OrderCurrencyCodefrom the currency of the order). - Payment data from the payment address (
AddrRef): payment type, credit card and bank account fields, ZIP. ShopIDis the shop the customer belongs to (CustomerOf).OrderLockedis the lock flag (ASlocked) of the shipping address,Nif not set.VoucherID/VoucherAmount: highest voucher ID and highest voucher amount found on the order lines (vouchers referenced by order lines);NULLif the order has no voucher.Shipdate/LastShipdate: earliest and latest scan-out date of all invoices linked to the order lines.TrackingID/ShipVendor: taken from the invoice with the highestInvoiceKey; the tracking ID falls back to the drop-shipment tracking ID of the order line if the invoice has none.NULLif the order has not been invoiced.
Notes
- All tables are read
WITH (NOLOCK); results may contain uncommitted data. - If
CustKeyis0andCustomerNrExternalis left empty, the filter matches customers with an empty external customer number or an empty e-mail address. Always pass eitherCustKeyor a non-emptyCustomerNrExternal. - Because the e-mail address is also matched, several customers (e.g. in different shops) can match; use
ShopIDto restrict. - The intermediate temporary table has unique indexes on
OrderNrandAddrRef. If two selected orders share the same payment address or more than one hasOrderNrNULL, the call fails with a SQL duplicate-key error. VoucherIDandVoucherAmountare aggregated independently withMAX; with several vouchers on one order they may come from different vouchers.- If the latest invoice has several lines with different fallback tracking IDs, the selection is not deterministic and an order may in rare cases appear more than once.
- The result contains sensitive payment data (card number, bank account).
Tables used
| Parameter | Type | Default | Description |
|---|---|---|---|
CustKey
|
int | 0 |
Internal customer key. If not Example: |
CustomerNrExternal
|
varchar(60) string |
– |
External customer number or customer e-mail address. Used only if Example: |
ShopID
|
varchar(3) string |
NULL |
Shop the customer must belong to. Used only if Example: |
OrderStatus
|
varchar(10) string |
NULL |
Optional filter on the order status. Other values than the listed ones disable the filter. Allowed values
Example: |
OrderDateFrom
|
datetime dateTime |
1900-01-01 |
Only orders with an order date on or after this value. Example: |
Result set 1 · Always (may be empty)
One row per matching order, sorted by OrderDate descending.
| Column | Type | Description |
|---|---|---|
OrderHeaderKey
|
int |
Internal key of the order |
OrderNr
Nullable |
int |
Pixi order number |
CreateDate
Nullable |
datetime dateTime |
Creation date of the order record |
OrderNrExternal
Nullable |
varchar(50) string |
External (shop) order number |
OrderTotal
Nullable |
money decimal |
Order total |
OrderLinesTotal
Nullable |
money decimal |
Total of the order lines |
WholeOrderState
Nullable |
varchar(6) string |
Order status of the order header |
Shipdate
Nullable |
datetime dateTime |
Earliest scan-out date of the invoices of the order |
LastShipdate
Nullable |
datetime dateTime |
Latest scan-out date of the invoices of the order |
TrackingID
Nullable |
varchar(8000) string |
Tracking ID of the latest invoice, or drop-shipment tracking ID of the order line as fallback |
ShipVendor
Nullable |
varchar(3) string |
Shipping vendor of the latest invoice |
ShopID
Nullable |
varchar(3) string |
Shop the customer belongs to ( |
OrderDate
Nullable |
datetime dateTime |
Order date |
ShipCost
Nullable |
money decimal |
Shipping cost of the order |
PaymentAddressId
Nullable |
int |
Key of the payment (billing) address |
ShipmentAddressId
Nullable |
int |
Key of the shipping address |
ShopNote
Nullable |
varchar(max) string |
Note from the shop |
PaymentType
Nullable |
char(1) string |
Payment type of the billing address |
VoucherID
Nullable |
varchar(50) string |
Highest voucher ID used in the order lines |
VoucherAmount
Nullable |
money decimal |
Highest voucher amount of the vouchers used in the order lines |
CcCardType
Nullable |
varchar(2) string |
Credit card type |
CcCardNr
Nullable |
varchar(25) string |
Credit card number |
CcCardName
Nullable |
varchar(60) string |
Credit card holder |
CcCardExp
Nullable |
varchar(4) string |
Credit card expiry |
Account
Nullable |
varchar(10) string |
Bank account number |
Blz
Nullable |
varchar(8) string |
Bank code (BLZ) |
BankName
Nullable |
varchar(50) string |
Bank name |
AccountName
Nullable |
varchar(27) string |
Account holder |
AddressRemarks
Nullable |
varchar(255) string |
Address remarks of the order |
AddrRef
Nullable |
int |
Key of the billing address (same as |
ZIP
Nullable |
varchar(10) string |
ZIP code of the billing address |
CustKey
Nullable |
int |
Internal customer key |
OrderLocked
Nullable |
varchar(1) string |
Lock flag of the shipping address, |
OrderCurrencyCode
Nullable |
varchar(3) string |
Currency code of the order (e.g. |
Response example
<SqlRowSet1>
<row>
<OrderHeaderKey>558812</OrderHeaderKey>
<OrderNr>400123</OrderNr>
<CreateDate>2024-03-11T09:14:22</CreateDate>
<OrderNrExternal>WEB-100245</OrderNrExternal>
<OrderTotal>89.9000</OrderTotal>
<OrderLinesTotal>84.9000</OrderLinesTotal>
<WholeOrderState>CLOSED</WholeOrderState>
<Shipdate>2024-03-12T15:02:10</Shipdate>
<LastShipdate>2024-03-12T15:02:10</LastShipdate>
<TrackingID>00340434161094042557</TrackingID>
<ShipVendor>DHL</ShipVendor>
<ShopID>SH1</ShopID>
<OrderDate>2024-03-11T09:10:00</OrderDate>
<ShipCost>5.0000</ShipCost>
<PaymentAddressId>912345</PaymentAddressId>
<ShipmentAddressId>912346</ShipmentAddressId>
<ShopNote/>
<PaymentType>R</PaymentType>
<AddressRemarks/>
<AddrRef>912345</AddrRef>
<ZIP>80331</ZIP>
<CustKey>10234</CustKey>
<OrderLocked>N</OrderLocked>
<OrderCurrencyCode>EUR</OrderCurrencyCode>
</row>
</SqlRowSet1>
POST https://apigateway.descartes.com/tms/pixi/
Content-Type: text/xml; charset=utf-8
Authorization: Basic BASE64(USERNAME:PASSWORD)
<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="https://apigateway.descartes.com/tms/pixi/">
<SOAP-ENV:Body>
<ns1:pixiGetOrderHeadersForCustomer>
<!-- <CustKey>10234</CustKey> -->
<!-- <CustomerNrExternal>max.mustermann@example.com</CustomerNrExternal> -->
<!-- <ShopID>SH1</ShopID> -->
<!-- <OrderStatus>OPEN</OrderStatus> -->
<!-- <OrderDateFrom>2024-01-01T00:00:00</OrderDateFrom> -->
</ns1:pixiGetOrderHeadersForCustomer>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
curl -X POST 'https://apigateway.descartes.com/tms/pixi/' \
--user 'USERNAME:PASSWORD' \
--header 'Content-Type: text/xml; charset=utf-8' \
--data-binary @- <<'XML'
<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="https://apigateway.descartes.com/tms/pixi/">
<SOAP-ENV:Body>
<ns1:pixiGetOrderHeadersForCustomer>
<!-- <CustKey>10234</CustKey> -->
<!-- <CustomerNrExternal>max.mustermann@example.com</CustomerNrExternal> -->
<!-- <ShopID>SH1</ShopID> -->
<!-- <OrderStatus>OPEN</OrderStatus> -->
<!-- <OrderDateFrom>2024-01-01T00:00:00</OrderDateFrom> -->
</ns1:pixiGetOrderHeadersForCustomer>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
XML
<?php
$soapClient = new SoapClient(null, [
'login' => 'USERNAME',
'password' => 'PASSWORD',
'location' => 'https://apigateway.descartes.com/tms/pixi/',
'uri' => 'https://apigateway.descartes.com/tms/pixi/',
]);
$arguments = [
// 'CustKey' => '10234',
// 'CustomerNrExternal' => 'max.mustermann@example.com',
// 'ShopID' => 'SH1',
// 'OrderStatus' => 'OPEN',
// 'OrderDateFrom' => '2024-01-01T00:00:00',
];
$soapArguments = [];
foreach ($arguments as $name => $value) {
$soapArguments[] = new SoapVar($value, XSD_STRING, '', '', $name);
}
$response = $soapClient->__soapCall('pixiGetOrderHeadersForCustomer', $soapArguments);
- SQL object:
- dbo.pipiGetOrderHeadersForCustomer