Postman collection
Customers Read

pixiGetCustomersToRefund

Returns customers whose customer account has a positive suggested refund, with balance, open orders and match status, optionally filtered by shop and amount.

Determines which customers should receive a refund from their customer account (CustomerAccount).

  1. Empty ShopId is treated as NULL. NULL values for AmountFrom / AmountTo fall back to 0 / 1000000.
  2. All customers whose customer account entries sum up to a positive amount are selected as candidates.
  3. For these candidates the internal procedure Pixi_CA_GetSummaryList calculates per customer:
    • FinancialBalance: sum of all customer account amounts.
    • OpenOrders: value of order lines in an open state (OrderStates.CA_IsOpenOrder = 1) that are not yet invoiced, reduced by unused vouchers and increased by shipping costs. Only orders whose payment method has CA_SubstractFromopenOrdersWhenRefund = 0 count; negative values per currency are set to 0.
    • SuggestedRefund: refundable account amount (entries without DoNotRefund, plus the matched part of entries with DoNotRefund) minus OpenOrders.
    • OpenToMatch: amount not yet matched.
    • IsMatched: match flag derived from the open-to-match sums per currency.
    • CurrencyId: currency of the values.
  4. The result contains only customers with SuggestedRefund > 0 and SuggestedRefund between AmountFrom and AmountTo (inclusive). If ShopId is given, only customers of that shop (Customers.CustomerOf) are returned; if IsAccountMatched is given, only customers with the matching IsMatched value.

No sort order is defined; there is no paging.

Notes

  • Read-only; all tables are read with NOLOCK, so values can reflect uncommitted data.
  • Behaviour depends on the settings DoNOTChargeShipCostOnSecondDelivery (whether shipping costs are added to open orders when an order is already partly invoiced), MultiCurrencyEnabled and HomeCurrency.
  • If MultiCurrencyEnabled = 1 and a customer has account entries or open orders in more than one currency, the amounts are converted to the shop's base currency using the exchange rate of the current day (pixi.ExchRate). If no rate exists for today, the amounts in that currency drop out of the sums. Without multi-currency, CurrencyId is the home currency.
  • The calculation runs over all customers with a positive account balance before the filters are applied, so the call can be expensive on large databases even with a restrictive ShopId.

Tables used

CustomerAccount · Read Customers · Read Settings · Read Orderlines · Read OrderStates · Read Invlines · Read OrderHeader · Read Voucher · Read Addresses · Read Payments · Read Shops · Read Currency · Read ExchRate · Read
SQL object:
dbo.pipiGetCustomersToRefund
Updated at 2026-10-30