Postman collection
Payments Read

pixiPayGetOrdersToAuthorize

Returns orders with lines in status HAL that are due for payment authorization for a given payment method, including amounts, card and address data.

Selects orders that a payment connector (for example a credit card processor) should authorize, and returns one row per order.

Selection steps:

  1. Collect all orders that have at least one order line in status HAL.
  2. Keep only orders where:
    • the order header was last updated more than 10 minutes ago (updatedate), so that the order is complete before it is processed,
    • the payment code of the order address (Addresses.aPayment) equals PaymentCode,
    • at least one of these holds: ccpNumOfTries <= 3, CCPReauthorizeYN = Y (re-authorization requested), ShowAll = 1, or ccpSetFailTries between 1 and 3 and ccpSetFailLastTime older than 10 minutes,
    • the customer is not locked (Customers.SLocked is not Y).
  3. Take the first RowCount orders, ordered by ccpNumOfTries ascending, then OrderHeaderKey ascending (orders with fewer attempts first).
  4. For these orders, sum OrderLineAmount of the lines in status ANG, HAL and AUS separately (missing statuses count as 0).

The result contains order totals, the per-status line totals, currency, shop ID, card data and address data of the order address, plus the authorization tracking fields of the order header. The final result is sorted by OrderHeaderKey ascending.

Notes

  • Read-only; all permanent tables are read WITH (NOLOCK), so uncommitted data may be returned.
  • Pitfall: in the result the column Addresses.eMail is returned under the alias CCPPaymentInfoOK (there is no column eMail). The column therefore contains the e-mail address of the order address, not a payment status flag.
  • The *_OrderCurr columns contain exactly the same values as their counterparts without suffix (comments in the code mark them for removal); no currency conversion happens.
  • The result contains sensitive card data (CardNumber, CardCVC, CardExpiration); handle and transport it accordingly.
  • ShowAll = 1 only bypasses the retry-count conditions; the 10-minute waiting time, payment code, HAL line and customer lock filters still apply.
  • RowCount limits the number of orders, not lines.
  • The 10-minute threshold is based on the server time (GETDATE()).

Tables used

Orderlines · Read Orderheader · Read Addresses · Read Customers · Read Currency · Read
SQL object:
dbo.pipiPayGetOrdersToAuthorize
Updated at 2026-10-30