Search purchase payments

distru-search-purchase-paymentsRead

Searches payments made to suppliers against purchase orders, one row per payment, with the purchase's payment status, paid amount and total.

Inputs

Every tool also takes the common inputs.

FieldTypeRequiredDescription
limitintegerNoDefault: 10
cursorstringNonextCursor of the previous call; keep the other arguments unchanged.
amountMaxstring or numberNoDollars, inclusive.
amountMinstring or numberNoDollars, inclusive.
paymentDateAfterstringNoWhen paid, inclusive. YYYY-MM-DD (start of day, company timezone) or ISO 8601 with a UTC offset.
paymentDateBeforestringNoWhen paid, inclusive. YYYY-MM-DD (end of day, company timezone) or ISO 8601 with a UTC offset.
paymentMethodIdsstring[]NoResolve via distru-search-lookups (type PAYMENT_METHOD).
paymentNumberstringNoCase-insensitive substring.
purchaseIdsstring[]NoResolve via distru-search-purchase-orders.
searchstringNoCase-insensitive substring of payment number, note or purchase number, or substring or fuzzy word match on supplier name; % and _ are wildcards. Keeps the sortBy order.
statusenum
ALLPOSTEDVOIDED
NoDefault POSTED; ALL for both.
supplierIdsstring[]NoThe purchase's supplier. Resolve via distru-search-companies.
sortByobjectNoDefault PAYMENT_DATE DESC.
sortBy.directionenum
ASCDESC
Yes
sortBy.fieldenum
INSERTED_ATPAYMENT_DATEPAYMENT_NUMBERUPDATED_AT
YesPAYMENT_DATE: when paid; INSERTED_AT: when recorded; UPDATED_AT: last change, a void included. PAYMENT_NUMBER sorts as text.

Output

Presence on a nested field assumes its parent exists.

FieldTypePresenceDescription
hasMorebooleanAlways
nextCursorstringCan be absent
totalCountintegerCan be absent
itemsobject[]Always
items[].idstringAlways
items[].paymentNumberstringAlways
items[].paymentDatestringAlways
items[].statusenum
POSTEDVOIDED
AlwaysVOIDED payments no longer count toward paid.
items[].voidedAtstringCan be null
items[].amountstringAlwaysDollars, as recorded; a void leaves it unchanged.
items[].paymentMethodobjectCan be nullNull once the method is deleted.
items[].paymentMethod.idstringAlways
items[].paymentMethod.namestringAlways
items[].notestringCan be null
items[].qbPaymentAccountstringCan be nullFull name of the QuickBooks Bank or Credit Card account the payment was made from. Null when it has none or the account is not in the QuickBooks cache.
items[].qbBillPaymentIdstringCan be nullIts QuickBooks bill payment ID.
items[].qbSyncStatusenum
DELETED_IN_QBOERRORNOT_SYNCEDPARTIALLY_SYNCEDPENDINGSYNCED
Can be nullNull unless the company's QuickBooks module is on and connected. PENDING and ERROR are its latest sync's outcome and win over the rest. A payment syncs only once its purchase has a QuickBooks bill and purchase payment sync is on, so NOT_SYNCED is normal before that.
items[].insertedAtstringAlways
items[].updatedAtstringAlwaysAlso moves on a void.
items[].purchaseobjectCan be nullNull when the caller's team can't see the purchase.
items[].purchase.idstringAlways
items[].purchase.purchaseNumberstringAlways
items[].purchase.paymentStatusenum
NOT_PAIDOVER_PAIDPAIDPARTIALLY_PAID
Always
items[].purchase.paidstringAlwaysSum of its non-voided payments.
items[].purchase.totalstringAlways
items[].supplierobjectCan be nullNull when the caller's team can't see it.
items[].supplier.idstringAlways
items[].supplier.namestringNull or absent
What the AI reads

Searches payments made to suppliers against purchase orders, one row per payment, with the purchase's payment status, paid amount and total. Use for a supplier's payments, those made in a date range, or one purchase's (purchaseIds); for purchase orders and their balances use distru-search-purchase-orders. Needs permission to view payments; a purchase's own payments are also on distru-get-purchase-order (includePayments), which needs only purchase view. A VOIDED payment keeps its amount as recorded but no longer counts toward the purchase's paid. purchase and supplier are null when the caller's team can't see them. qbBillPaymentId is its QuickBooks bill payment ID; qbPaymentAccount is the full name of the QuickBooks account it was paid from. qbSyncStatus is null unless the company's QuickBooks module is on and connected; PENDING and ERROR are its latest sync's outcome and win over the rest; DELETED_IN_QBO = the bill payment was deleted in QuickBooks; NOT_SYNCED = it isn't in QuickBooks, which is normal until its purchase has a QuickBooks bill and purchase payment sync is on. For why a sync failed, use distru-search-quickbooks-activities with purchaseOrderIds (its purchase.id).