Search invoice payments

distru-search-invoice-paymentsRead

Searches payments received against invoices, one row per payment, without the credits it used or created (use distru-get-invoice-payment for those).

Inputs

Every tool also takes the common inputs.

FieldTypeRequiredDescription
limitintegerNoDefault: 10
cursorstringNonextCursor of the previous call; keep the other arguments unchanged.
appliedAmountMaxstring or numberNoDollars, inclusive.
appliedAmountMinstring or numberNoDollars, inclusive.
customerIdsstring[]NoThe invoice's customer. Resolve via distru-search-companies.
invoiceIdsstring[]NoResolve via distru-search-invoices.
paymentDateAfterstringNoWhen received, inclusive. YYYY-MM-DD (start of day, company timezone) or ISO 8601 with a UTC offset.
paymentDateBeforestringNoWhen received, 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.
searchstringNoCase-insensitive substring of payment number, note or invoice number, or substring or fuzzy word match on customer name; % and _ are wildcards. Keeps the sortBy order.
statusenum
ALLPOSTEDVOIDED
NoDefault POSTED; ALL for both.
sortByobjectNoDefault PAYMENT_DATE DESC.
sortBy.directionenum
ASCDESC
Yes
sortBy.fieldenum
INSERTED_ATPAYMENT_DATEPAYMENT_NUMBERUPDATED_AT
YesPAYMENT_DATE: when received; 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.

FieldTypePresence
hasMorebooleanAlways
nextCursorstringCan be absent
totalCountintegerCan be absent
itemsobject[]Always
items[].idstringAlways
items[].paymentNumberstringAlways
items[].paymentDatestringAlways
items[].statusenum
POSTEDVOIDED
Always
items[].voidedAtstringCan be null
items[].receivedobjectCan be null
items[].received.amountstringAlways
items[].received.paymentMethodobjectCan be null
items[].received.paymentMethod.idstringAlways
items[].received.paymentMethod.namestringAlways
items[].creditAmountstringAlways
items[].appliedAmountstringAlways
items[].overpaidAmountstringAlways
items[].notestringCan be null
items[].customerobjectCan be null
items[].customer.idstringAlways
items[].customer.namestringNull or absent
items[].invoiceobjectCan be null
items[].invoice.idstringAlways
items[].invoice.invoiceNumberstringAlways
items[].invoice.paymentStatusenum
NOT_PAIDOVER_PAIDPAIDPARTIALLY_PAID
Always
items[].qbDepositAccountstringCan be null
items[].qbPaymentIdstringCan be null
items[].qbSyncStatusenum
DELETED_IN_QBOERRORNOT_SYNCEDPARTIALLY_SYNCEDPENDINGSYNCED
Can be null
items[].insertedAtstringAlways
items[].updatedAtstringAlways
What the AI reads

Searches payments received against invoices, one row per payment, without the credits it used or created (use distru-get-invoice-payment for those). Use for an invoice's payments (invoiceIds), a customer's, or those received in a date range; for invoices and their balances use distru-search-invoices. appliedAmount is what counts toward the invoice's paid amount: received.amount + creditAmount = appliedAmount + overpaidAmount, and overpaidAmount became customer credit. received is null when the payment was made entirely with credit. A VOIDED payment keeps its amounts as recorded, so leave it out of totals. customer and invoice are null when the caller's team can't see them. qbSyncStatus ERROR: distru-search-quickbooks-activities with paymentIds gives the error. ERROR or NOT_SYNCED: distru-sync-to-quickbooks pushes it, or says why it can't.