Description
Returns comprehensive CRM (customer relationship management) statistics per customer, including order counts across rolling time windows, invoice totals for the first, second, and last orders, year-based totals relative to the customer's first order date, and rolling 365/730-day totals relative to the calculation end date.
Optionally filter by shop ID, customer reference, or date range. When no date range is specified, the calculation end date defaults to today. Results are ordered by CustKey ascending and paginated using Rows and Offset.
Monetary amounts are returned in the original order currency by default. When multi-currency is enabled in the pixi system settings, all amounts are converted to the base currency and the BaseCurrency field indicates which currency was used.
Request Parameters
# |
Name |
Type |
Required |
Example |
Description |
1 |
CustomerOf |
varchar(3) |
0 |
REH |
Shop ID to filter results to a specific shop. When omitted, all shops are included. |
2 |
CalculationStart |
datetime |
0 |
2024-01-01 |
Start of the calculation date range. Filters invoices and orders to those on or after this date. When omitted, no start date filter is applied. |
3 |
CalculationEnd |
datetime |
0 |
2024-12-31 |
End of the calculation date range. Also used as the reference point for rolling time window calculations (LastYearFromNow*, NextToLastYearFromNow*). When omitted, defaults to today. |
4 |
CustRef |
int |
0 |
12345 |
Customer ID to retrieve statistics for a single customer. When omitted, all customers matching the other filters are returned. |
5 |
Rows |
int |
0 |
1000 |
Maximum number of customer rows to return. Default is 1000. |
6 |
Offset |
int |
0 |
0 |
Cursor-based pagination offset: returns only customers with CustKey greater than this value. Pass the last CustKey received in the previous page to fetch the next page. Default is 0 (start from the beginning). |
Request body
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:dem="https://api.pixi.eu/soap/demosandbox/">
<soapenv:Header/>
<soapenv:Body>
<dem:pixiGetCRMCustomers>
<dem:CustomerOf>REH</dem:CustomerOf>
<dem:CalculationStart>2024-01-01</dem:CalculationStart>
<dem:CalculationEnd>2024-12-31</dem:CalculationEnd>
<dem:CustRef>0</dem:CustRef>
<dem:Rows>1000</dem:Rows>
<dem:Offset>0</dem:Offset>
</dem:pixiGetCRMCustomers>
</soapenv:Body>
</soapenv:Envelope>Response
Body 1: Customer CRM statistics
# |
Name |
Type |
Description |
1 |
CustKey |
int |
Unique customer identifier. |
2 |
DaysSinceFirstOrder |
int |
Number of days between the customer's first order date and today. |
3 |
DaysSinceLastOrder |
int |
Number of days between the customer's last order date and today. |
4 |
DaysBetweenFirstAndSecondOrder |
int |
Number of days between the customer's first and second order. 0 if the customer has only one order. |
5 |
DaysBetweenFirstAndLastOrder |
int |
Number of days between the customer's first and last order. 0 if the customer has only one order. |
6 |
Orders90days |
int |
Number of orders placed in the last 90 days from today. |
7 |
Orders365days |
int |
Number of orders placed in the last 365 days from today. |
8 |
Orders730days |
int |
Number of orders placed in the last 730 days from today. |
9 |
OrdersTotal |
int |
Total number of orders placed by the customer within the calculation date range. |
10 |
FirstOrderTotal |
decimal |
Invoice total of the customer's first order (including shipping costs). |
11 |
FirstOrderTotalWithoutShipcosts |
decimal |
Invoice total of the customer's first order excluding shipping costs. |
12 |
FirstOrderReturnTotal |
decimal |
Return credit total associated with the customer's first order (negative value indicates a deduction). |
13 |
FirstOrderReturnTotalWithoutShipcosts |
decimal |
Return credit total for the first order excluding shipping costs. |
14 |
SecondOrderTotal |
decimal |
Invoice total of the customer's second order (including shipping costs). NULL if the customer has fewer than two orders. |
15 |
SecondOrderTotalWithoutShipcosts |
decimal |
Invoice total of the second order excluding shipping costs. |
16 |
SecondOrderReturnTotal |
decimal |
Return credit total associated with the customer's second order. |
17 |
SecondOrderReturnTotalWithoutShipcosts |
decimal |
Return credit total for the second order excluding shipping costs. |
18 |
LastOrderTotal |
decimal |
Invoice total of the customer's most recent order (including shipping costs). |
19 |
LastOrderTotalWithoutShipcosts |
decimal |
Invoice total of the most recent order excluding shipping costs. |
20 |
LastOrderReturnTotal |
decimal |
Return credit total associated with the customer's most recent order. |
21 |
LastOrderReturnTotalWithoutShipcosts |
decimal |
Return credit total for the most recent order excluding shipping costs. |
22 |
FirstYearTotal |
decimal |
Sum of invoice totals in the 365 days following the customer's first invoice date. |
23 |
FirstYearTotalWithoutShipcosts |
decimal |
First year total excluding shipping costs. |
24 |
FirstYearReturnTotal |
decimal |
Sum of return credits in the first year after the customer's first invoice. |
25 |
FirstYearReturnTotalWithoutShipcosts |
decimal |
First year return total excluding shipping costs. |
26 |
SecondYearTotal |
decimal |
Sum of invoice totals between day 365 and day 730 after the customer's first invoice date. |
27 |
SecondYearTotalWithoutShipcosts |
decimal |
Second year total excluding shipping costs. |
28 |
SecondYearReturnTotal |
decimal |
Sum of return credits in the second year after the customer's first invoice. |
29 |
SecondYearReturnTotalWithoutShipcosts |
decimal |
Second year return total excluding shipping costs. |
30 |
LastYearTotal |
decimal |
Sum of invoice totals in the 365 days before the customer's last invoice date. |
31 |
LastYearTotalWithoutShipcosts |
decimal |
Last year (relative to last invoice) total excluding shipping costs. |
32 |
LastYearReturnTotal |
decimal |
Sum of return credits in the year before the customer's last invoice. |
33 |
LastYearReturnTotalWithoutShipcosts |
decimal |
Last year return total excluding shipping costs. |
34 |
NextToLastYearFromNowTotal |
decimal |
Sum of invoice totals between 365 and 730 days before the calculation end date (or today if not specified). |
35 |
NextToLastYearFromNowTotalWithoutShipcosts |
decimal |
Next-to-last year from now total excluding shipping costs. |
36 |
NextToLastYearFromNowReturnTotal |
decimal |
Sum of return credits between 365 and 730 days before the calculation end date. |
37 |
NextToLastYearFromNowReturnTotalWithoutShipcosts |
decimal |
Next-to-last year from now return total excluding shipping costs. |
38 |
LastYearFromNowTotal |
decimal |
Sum of invoice totals in the 365 days before the calculation end date (or today if not specified). |
39 |
LastYearFromNowTotalWithoutShipcosts |
decimal |
Last year from now total excluding shipping costs. |
40 |
LastYearFromNowReturnTotal |
decimal |
Sum of return credits in the last 365 days from the calculation end date. |
41 |
LastYearFromNowReturnTotalWithoutShipcosts |
decimal |
Last year from now return total excluding shipping costs. |
42 |
OverallTotal |
decimal |
Sum of all invoice totals for the customer within the calculation date range. |
43 |
OverallTotalWithoutShipcosts |
decimal |
Overall total excluding shipping costs. |
44 |
OverallReturnTotal |
decimal |
Sum of all return credits for the customer within the calculation date range. |
45 |
OverallReturnTotalWithoutShipcosts |
decimal |
Overall return total excluding shipping costs. |
46 |
BaseCurrency |
varchar(3) |
ISO currency code of the amounts returned. NULL when multi-currency conversion is disabled (amounts are in original order currency). Populated with the base currency code when multi-currency is enabled. |
Additional Notes
Pagination: results are ordered by CustKey ascending. To retrieve the next page, pass the last CustKey value from the current response as the Offset parameter.
CalculationEnd default: when CalculationEnd is not provided, the calculation end date defaults to the current date (today). This affects the rolling window fields: LastYearFromNow* (last 365 days from today) and NextToLastYearFromNow* (365-730 days ago from today).
Multi-currency: when the MultiCurrencyEnabled system setting is active, all monetary amounts are converted to the base currency using the exchange rate stored on each invoice. The BaseCurrency field indicates the currency used. When disabled, amounts reflect the original order currency and BaseCurrency is NULL.
Return totals: return credit amounts are stored as positive values representing the sum of credits. Subtract ReturnTotal from Total to get the net revenue for a given period.