Get a customer credit

distru-get-creditRead

Gets one customer credit by ID, with where it came from (sourcePayment or sourceReturn) and where it was applied (creditUses); line items and history are opt-in.

Inputs

Every tool also takes the common inputs.

FieldTypeRequiredDescription
idstringYesResolve via distru-search-credits.
includeCreditActivitiesbooleanNoHistory, oldest first. creditUse is set on a CREDIT_USED or CREDIT_USE_DELETED entry: what was applied or released. _IN_QBO types came from QuickBooks.
includeCreditItemsbooleanNoLine items, each product line followed by its tax lines; tax is set only on a tax line. price is per unit.

Output

Presence on a nested field assumes its parent exists.

FieldTypePresence
creditobjectCan be null
credit.idstringAlways
credit.creditNumberstringAlways
credit.statusenum
ACTIVECANCELEDREDEEMED
Always
credit.sourceenum
INVOICE_PAYMENTQB_CREDIT_MEMOQB_PAYMENTRETURNUSER
Always
credit.amountstringAlways
credit.originalAmountstringAlways
credit.remainingBalancestringAlways
credit.customerobjectCan be null
credit.customer.idstringAlways
credit.customer.namestringNull or absent
credit.ownerobjectCan be null
credit.owner.idstringAlways
credit.owner.profileobjectAlways
credit.owner.profile.fullNamestringAlways
credit.externalNotestringCan be null
credit.internalNotestringCan be null
credit.qbCreditMemoIdstringCan be null
credit.qbPaymentIdstringCan be null
credit.qbSyncStatusenum
DELETED_IN_QBOERRORNOT_SYNCEDPARTIALLY_SYNCEDPENDINGSYNCED
Can be null
credit.insertedAtstringAlways
credit.updatedAtstringAlways
credit.canceledAtstringCan be null
credit.sourcePaymentobjectCan be null
credit.sourcePayment.idstringAlways
credit.sourcePayment.paymentNumberstringAlways
credit.sourcePayment.invoiceobjectCan be null
credit.sourcePayment.invoice.idstringAlways
credit.sourcePayment.invoice.invoiceNumberstringAlways
credit.sourceReturnobjectCan be null
credit.sourceReturn.idstringAlways
credit.sourceReturn.returnNumberstringAlways
credit.creditUsesobject[]Always
credit.creditUses[].amountstringAlways
credit.creditUses[].appliedAtstringAlways
credit.creditUses[].paymentobjectCan be null
credit.creditUses[].payment.idstringAlways
credit.creditUses[].payment.paymentNumberstringAlways
credit.creditUses[].invoiceobjectCan be null
credit.creditUses[].invoice.idstringAlways
credit.creditUses[].invoice.invoiceNumberstringAlways
credit.creditItemsobject[]Can be absent
credit.creditItems[].quantitystringAlways
credit.creditItems[].pricestringAlways
credit.creditItems[].descriptionstringCan be null
credit.creditItems[].productobjectAlways
credit.creditItems[].product.idstringAlways
credit.creditItems[].product.namestringAlways
credit.creditItems[].packageobjectCan be null
credit.creditItems[].package.idstringAlways
credit.creditItems[].package.metrcLabelstringAlways
credit.creditItems[].taxobjectCan be null
credit.creditItems[].tax.idstringAlways
credit.creditItems[].tax.namestringAlways
credit.creditActivitiesobject[]Can be absent
credit.creditActivities[].typeenum
CREDIT_CANCELEDCREDIT_CANCELED_IN_QBOCREDIT_CREATEDCREDIT_CREATED_IN_QBOCREDIT_DELETEDCREDIT_DELETED_IN_QBOCREDIT_EDITEDCREDIT_EDITED_IN_QBOCREDIT_USE_DELETEDCREDIT_USE_DELETED_IN_QBOCREDIT_USEDCREDIT_USED_IN_QBO
Always
credit.creditActivities[].insertedAtstringAlways
credit.creditActivities[].userobjectCan be null
credit.creditActivities[].user.idstringAlways
credit.creditActivities[].user.profileobjectAlways
credit.creditActivities[].user.profile.fullNamestringAlways
credit.creditActivities[].creditUseobjectCan be null
credit.creditActivities[].creditUse.amountstringAlways
credit.creditActivities[].creditUse.paymentobjectCan be null
credit.creditActivities[].creditUse.payment.idstringAlways
credit.creditActivities[].creditUse.payment.paymentNumberstringAlways
What the AI reads

Gets one customer credit by ID, with where it came from (sourcePayment or sourceReturn) and where it was applied (creditUses); line items and history are opt-in. To browse or filter credits use distru-search-credits. amount is the current face value, originalAmount the value at issue. remainingBalance is amount minus the credit already applied; a CANCELED credit keeps its balance but can't be spent, so leave CANCELED credits out of what a customer has available. INVOICE_PAYMENT and QB_PAYMENT credits are a payment's overpayment. customer is null when the caller's team can't see it. qbSyncStatus ERROR: distru-search-quickbooks-activities with creditIds gives the error. ERROR or NOT_SYNCED: distru-sync-to-quickbooks pushes it, or says why it can't. creditUses lists live uses only, oldest first: a use released by a void, a reversing cancel or a QuickBooks change is left out, and creditActivities records it. sourcePayment is null once its invoice is deleted or hidden from the caller's team, and sourceReturn once the return is removed or hidden; a credit use's payment and invoice are null when the team can't see that invoice. Null if no credit matches the ID; a permission error if the caller can't view it.