pixiGetInvoicesForCustomer
Returns the invoices of one customer, identified by customer key or external customer number, optionally filtered to a single invoice number.
Lists invoices together with payment, bank or card, shipping and order information for one customer.
Identifying the customer
NULL values are first replaced by 0 (for CustKey) or an empty string. Then exactly one identifier must be set:
CustKey<> 0 andCustomerNrExternalempty: the invoices of this customer key are returned.CustKey= 0 andCustomerNrExternalset: all customers inCustomerswith thisCustomerNrExternalare used. If several customers share the number, the invoices of all of them are returned.- Both set or both empty: no customer is selected and the result set is empty.
Invoice filter
- If
InvoiceNris empty orNULL, all invoices of the customer are returned. - Otherwise only the invoice with exactly this
InvoiceNris returned.
Returned data per invoice
- Invoice data from
Invoices: number, date, payment and shipment address IDs, total, payment code, payment date, paid amount, tracking ID, ship date and reminder level. PaymentTextcomes fromPayments. If the code is not found there, the payment code itself is returned.Paidis1if the paid amount (a missing amount counts as 0) equals the total, otherwise0.- Card and bank data (
Cc…,Account,Blz,BankName,AccountName) come from the payment address inAddresses. OrderNrandOrderNrExternalare the highest values found among the order lines linked to the invoice lines. They areNULLif the invoice has no linked order lines.OrderCurrencyCodeis the currency code frompixi.Currency.
The code does not define a sort order.
Notes
- All tables are read
WITH (NOLOCK), so uncommitted data can appear in the result. pixi.Currencyis joined with an inner join. Invoices whoseCurrencyIdhas no matching currency are not returned.- If
CustKeyandCustomerNrExternalare both sent, the call returns no rows and no error. Send only one of them. - If the invoice total is
NULL, the comparison forPaidis not true and the column returns1. - The result contains sensitive payment data: card number, card holder, card expiry and bank account.
Tables used
| Parameter | Type | Default | Description |
|---|---|---|---|
CustKey
|
int | 0 |
Internal customer key. Use either this or Example: |
CustomerNrExternal
|
varchar(60) string |
– |
External customer number, for example the shop customer number. It is used only if Example: |
InvoiceNr
|
varchar(20) string |
NULL |
Optional invoice number. If it is set, only this invoice is returned. Empty or Example: |
Result set 1 · Always; empty if no customer could be identified or no invoice matches.
One row per invoice of the selected customer(s).
| Column | Type | Description |
|---|---|---|
InvoiceNr
Nullable |
string |
Invoice number. |
InvoiceDate
Nullable |
dateTime |
Invoice date ( |
PaymentAddressId
Nullable |
int |
Reference to the payment (billing) address ( |
ShipmentAddressId
Nullable |
int |
Reference to the shipment address ( |
total
Nullable |
decimal |
Invoice total. |
PaymentCode
Nullable |
string |
Payment method code ( |
PaymentText
Nullable |
string |
Payment method text from |
PaymentDate
Nullable |
dateTime |
Payment date ( |
Paid
|
bit boolean |
1 if the paid amount ( |
TotalToPay
Nullable |
decimal |
Amount to pay; same value as |
PaidSum
Nullable |
decimal |
Amount paid so far ( |
CcCardType
Nullable |
string |
Credit card type from the payment address. |
CcCardNr
Nullable |
string |
Credit card number from the payment address. |
CcCardName
Nullable |
string |
Name of the card holder. |
CcCardExp
Nullable |
string |
Card expiry. |
Account
Nullable |
string |
Bank account number from the payment address. |
Blz
Nullable |
string |
Bank code (BLZ). |
BankName
Nullable |
string |
Name of the bank. |
AccountName
Nullable |
string |
Name of the account holder. |
TrackingID
Nullable |
string |
Shipment tracking ID. |
ShipDate
Nullable |
dateTime |
Scan-out (shipping) date. |
ReminderLevel
Nullable |
int |
Reminder (dunning) level of the invoice. |
OrderNr
Nullable |
int |
Highest order number among the order lines linked to the invoice lines. |
OrderNrExternal
Nullable |
string |
Highest external order number among the linked order lines. |
OrderCurrencyCode
Nullable |
string |
Currency code ( |
Response example
<SqlRowSet1>
<row>
<InvoiceNr>RE2024001234</InvoiceNr>
<InvoiceDate>2024-03-12T10:15:00</InvoiceDate>
<PaymentAddressId>88231</PaymentAddressId>
<ShipmentAddressId>88232</ShipmentAddressId>
<total>129.90</total>
<PaymentCode>VK</PaymentCode>
<PaymentText>Vorkasse</PaymentText>
<PaymentDate>2024-03-14T00:00:00</PaymentDate>
<Paid>true</Paid>
<TotalToPay>129.90</TotalToPay>
<PaidSum>129.90</PaidSum>
<TrackingID>00340434161234567890</TrackingID>
<ShipDate>2024-03-15T08:42:00</ShipDate>
<ReminderLevel>0</ReminderLevel>
<OrderNr>502311</OrderNr>
<OrderNrExternal>SHOP-77812</OrderNrExternal>
<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:pixiGetInvoicesForCustomer>
<!-- <CustKey>4711</CustKey> -->
<!-- <CustomerNrExternal>SHOP-100234</CustomerNrExternal> -->
<!-- <InvoiceNr>RE2024001234</InvoiceNr> -->
</ns1:pixiGetInvoicesForCustomer>
</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:pixiGetInvoicesForCustomer>
<!-- <CustKey>4711</CustKey> -->
<!-- <CustomerNrExternal>SHOP-100234</CustomerNrExternal> -->
<!-- <InvoiceNr>RE2024001234</InvoiceNr> -->
</ns1:pixiGetInvoicesForCustomer>
</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' => '4711',
// 'CustomerNrExternal' => 'SHOP-100234',
// 'InvoiceNr' => 'RE2024001234',
];
$soapArguments = [];
foreach ($arguments as $name => $value) {
$soapArguments[] = new SoapVar($value, XSD_STRING, '', '', $name);
}
$response = $soapClient->__soapCall('pixiGetInvoicesForCustomer', $soapArguments);
- SQL object:
- dbo.pipiGetInvoicesForCustomer