This guide covers how to implement refunds using Conductor’s QuickBooks Desktop API. We’ll cover two main scenarios:
- Invoice-based refunds (full or partial)
- Custom refunds (not linked to any invoice)
Invoice-based refund
For invoice-based refunds, you will create a credit memo and then apply it to the relevant invoice using a receive payment transaction to reduce the outstanding balance.
Step 1: Create the credit memo
First, create a credit memo for the customer for the amount you wish to refund. This credit memo can be for the full or partial amount of the invoice.
Here’s an example of how to create a credit memo:
const creditMemo = await conductor.qbd.creditMemo.add("{{END_USER_ID}}", {
CustomerRef: {
ListID: "customer_list_id",
},
TxnDate: "2024-10-23",
RefNumber: "REFUND-123",
Memo: "Refund for Invoice INV-001",
CreditMemoLineAdd: [
{
ItemRef: {
ListID: "item_list_id",
},
Desc: "Refund for Invoice #123",
Quantity: 1,
Amount: "50.00",
},
],
});
Step 2: Apply the credit memo to the invoice
Next, apply the credit memo to the outstanding invoice using a receive payment request. This will reduce the balance of the invoice by the credit amount.
Here’s an example of how to apply the credit:
const receivePayment = await conductor.qbd.receivePayment.add(
"{{END_USER_ID}}",
{
CustomerRef: {
ListID: "customer_list_id",
},
TotalAmount: "0.00",
Memo: "Applying credit memo to invoice",
AppliedToTxnAdd: {
TxnID: "original_invoice_txn_id",
PaymentAmount: "0.00",
SetCredit: {
CreditTxnID: creditMemo.TxnID,
AppliedAmount: "50.00",
},
},
},
);
Custom refund (not linked to any invoice)
For a custom refund not linked to any specific invoice, simply create a credit memo to record the amount owed to the customer.
Here’s an example of how to create a custom credit memo:
const standaloneCreditMemo = await conductor.qbd.creditMemo.add(
"{{END_USER_ID}}",
{
CustomerRef: {
ListID: "customer_list_id",
},
TxnDate: "2024-10-23",
RefNumber: "REFUND-124",
Memo: "Goodwill refund",
CreditMemoLineAdd: [
{
ItemRef: {
ListID: "refund_item_list_id",
},
Desc: "Customer satisfaction refund",
Amount: "75.00",
},
],
},
);
Common scenarios
Partial refund
Modify the CreditMemoLineAdd.Amount
to match the partial refund amount:
CreditMemoLineAdd: [
{
ItemRef: { ListID: "item_list_id" },
Desc: "Partial refund - 50%",
Amount: "25.00",
},
];
Multiple item refund
Use multiple CreditMemoLineAdd
entries:
CreditMemoLineAdd: [
{
ItemRef: { ListID: "item1_list_id" },
Desc: "Refund - Item 1",
Amount: "30.00",
},
{
ItemRef: { ListID: "item2_list_id" },
Desc: "Refund - Item 2",
Amount: "20.00",
},
];