# Quickbook API Doc ## Invoice ### Invoice object https://developer.intuit.com/app/developer/qbo/docs/api/accounting/all-entities/invoice ATTRIBUTES หลักๆของ Invoice object | ATTRIBUTES Name | Type | Description | | ---------------- | ------------- | ----------------------------------------------------------------- | | Id | String | | | CustomerRef | ReferenceType | อ้างอิงถึงลูกค้าที่เกี่ยวข้องกับใบแจ้งหนี้ | | Line [0..n] | Line | รายการสินค้า/บริการที่ขาย | | TotalAmt | BigDecimal | ยอดรวมของใบแจ้งหนี้ | | Balance | Decimal | ยอดคงเหลือของใบแจ้งหนี้หลังจากหักการชำระเงินที่ได้รับแล้ว<br> - คำนวณโดยระบบ QuickBooks โดยอัตโนมัติ<br> - หาก `Balance` เป็น `0` แสดงว่าใบแจ้งหนี้ได้รับการ`ชำระเงินครบถ้วนแล้ว` | | LinkedTxn [0..n] | LinkedTxn | รายการธุรกรรมที่เชื่อมโยงกับใบแจ้งหนี้ เช่น การชำระเงิน (Payment) | >[!Note] >ข้างต้นเป็นเพียงแค่บาง ATTRIBUTES ที่สำคัญเท่านั้น สามารถดูทั้งหมดได้ที่ [Official Doc](https://developer.intuit.com/app/developer/qbo/docs/api/accounting/all-entities/invoice "Official Doc") ตัวอย่างของ Invoice object ```json { "Id": "123", "CustomerRef": { "value": "1", "name": "John Doe" }, "Line": [ { "Id": "1", "LineNum": 1, "Description": "Custom Design", "Amount": 1000.00, "DetailType": "SalesItemLineDetail", "SalesItemLineDetail": { "ItemRef": { "value": "2", "name": "Design Service" }, "Qty": 1, "UnitPrice": 1000.00 } } ], "TotalAmt": 1000.00, "LinkedTxn": [ { "TxnId": "456", "TxnType": "Payment" } ] } ``` --- ### Create an invoice https://developer.intuit.com/app/developer/qbo/docs/api/accounting/all-entities/invoice#create-an-invoice - ต้องมีอย่างน้อย 1 รายการสินค้า `Line` - ต้องมีการอ้างอิงถึงลูกค้า `CustomerRef` **Request URL** ``` POST /v3/company/<realmID>/invoice Content type:application/json Production Base URL:https://quickbooks.api.intuit.com Sandbox Base URL:https://sandbox-quickbooks.api.intuit.com ``` **Request Body** | ATTRIBUTES | Require | Type | Description | | ----------- | --- | ------------------- | ----------- | | CustomerRef | Required | ReferenceType | อ้างอิงไปยังลูกค้าที่จะออกใบแจ้งหนี้ | | Line [0..n] | Required | Invoice line object | รายการสินค้า/บริการที่ขาย | | ProjectRef | Conditionally required | ReferenceType | อ้างอิงไปยัง Project (ถ้ามี) ที่เชื่อมโยงกับรายการนี้ | | CurrencyRef | Conditionally required | CurrencyRefType | สกุลเงินของการชำระเงิน (ใช้เมื่อเปิดใช้งาน Multicurrency) | **Returns** The invoice response body. ตัวอย่างของ Request Body ```json { "Line": [ { "DetailType": "SalesItemLineDetail", "Amount": 100.0, "SalesItemLineDetail": { "ItemRef": { "name": "Concrete", "value": "3" } } } ], "CustomerRef": { "value": "58" } } ``` ตัวอย่างของ Returns ```json { "Invoice": { "AllowIPNPayment": false, "AllowOnlinePayment": false, "AllowOnlineCreditCardPayment": false, "AllowOnlineACHPayment": false, "domain": "QBO", "sparse": false, "Id": "243", "SyncToken": "0", "MetaData": { "CreateTime": "2025-05-27T01:18:29-07:00", "LastModifiedByRef": { "value": "9341454710333993" }, "LastUpdatedTime": "2025-05-27T01:18:29-07:00" }, "CustomField": [], "DocNumber": "1088", "TxnDate": "2025-05-26", "CurrencyRef": { "value": "USD", "name": "United States Dollar" }, "LinkedTxn": [], "Line": [ { "Id": "1", "LineNum": 1, "Amount": 100.00, "DetailType": "SalesItemLineDetail", "SalesItemLineDetail": { "ItemRef": { "value": "3", "name": "Concrete" }, "ItemAccountRef": { "value": "48", "name": "Landscaping Services:Job Materials:Fountains and Garden Lighting" }, "TaxCodeRef": { "value": "NON" } } }, { "Amount": 100.00, "DetailType": "SubTotalLineDetail", "SubTotalLineDetail": {} } ], "TxnTaxDetail": { "TotalTax": 0 }, "CustomerRef": { "value": "58", "name": "Xun Flowerrr" }, "BillAddr": { "Id": "134" }, "ShipAddr": { "Id": "134" }, "FreeFormAddress": true, "ShipFromAddr": { "Id": "158", "Line1": "123 Sierra Way", "Line2": "San Pablo, CA 87999" }, "DueDate": "2025-06-25", "TotalAmt": 100.00, "ApplyTaxAfterDiscount": false, "PrintStatus": "NeedToPrint", "EmailStatus": "NotSet", "Balance": 100.00 }, "time": "2025-05-27T01:18:28.731-07:00" } ``` --- ### Void an invoice https://developer.intuit.com/app/developer/qbo/docs/api/accounting/all-entities/invoice#void-an-invoice การยกเลิกใบแจ้งหนี้ (Void) โดยไม่ลบข้อมูลออกจากระบบ โดยระบบจะเปลี่ยนทุก `ATTRIBUTES` ที่เกี่ยวกับราคาและจำนวสินค้าเป็น 0 ทั้งหมด **Request URL** ``` POST /v3/company/<realmID>/invoice?operation=void Content type:application/json Production Base URL:https://quickbooks.api.intuit.com Sandbox Base URL:https://sandbox-quickbooks.api.intuit.com ``` **Request Body** | ATTRIBUTES | Require | Type | Description | | ---------- | -------- | ------ | ----------- | | SyncToken | Required | String | Token ใช้สำหรับการ track version ของ object นี้ต้องค่าล่าสุดจึงจะสามารถ Void ได้ | | id | Required | String | Id ของ Invoice | ตัวอย่าง Request Body ```json { "SyncToken": "0", "Id": "129" } ``` ตัวอย่าง Returns ```json { "Invoice": { "AllowIPNPayment": false, "AllowOnlinePayment": false, "AllowOnlineCreditCardPayment": false, "AllowOnlineACHPayment": false, "domain": "QBO", "sparse": false, "Id": "244", "SyncToken": "2", "MetaData": { "CreateTime": "2025-05-27T01:46:25-07:00", "LastModifiedByRef": { "value": "9341454710333993" }, "LastUpdatedTime": "2025-05-27T01:46:54-07:00" }, "CustomField": [], "DocNumber": "1089", "TxnDate": "2025-05-26", "CurrencyRef": { "value": "USD", "name": "United States Dollar" }, "PrivateNote": "Voided", "LinkedTxn": [], "Line": [ { "Id": "1", "LineNum": 1, "Amount": 0, "DetailType": "SalesItemLineDetail", "SalesItemLineDetail": { "ItemRef": { "value": "3", "name": "Concrete" }, "ItemAccountRef": { "value": "48", "name": "Landscaping Services:Job Materials:Fountains and Garden Lighting" }, "TaxCodeRef": { "value": "NON" } } }, { "Amount": 0, "DetailType": "SubTotalLineDetail", "SubTotalLineDetail": {} } ], "TxnTaxDetail": { "TotalTax": 0 }, "CustomerRef": { "value": "58", "name": "Xun Flowerrr" }, "BillAddr": { "Id": "134" }, "ShipAddr": { "Id": "134" }, "FreeFormAddress": true, "ShipFromAddr": { "Id": "159", "Line1": "123 Sierra Way", "Line2": "San Pablo, CA 87999" }, "DueDate": "2025-06-25", "TotalAmt": 0, "ApplyTaxAfterDiscount": false, "PrintStatus": "NeedToPrint", "EmailStatus": "NotSet", "Balance": 0 }, "time": "2025-05-27T01:46:53.635-07:00" } ``` >[!Note] >จากตัวอย่าง Attribute อย่าง `TotalAmt` `Line[n].Amount` จะถูกเปลี่ยนเป็น 0 --- ## Payment ### Payment object https://developer.intuit.com/app/developer/qbo/docs/api/accounting/all-entities/payment#the-payment-object ATTRIBUTES หลักๆของ Payment object | ATTRIBUTES Name | Type | Description | | ---------------- | ------------- | --------------------------------------------------------------------------------- | | Id | String | | | CustomerRef | ReferenceType | อ้างอิงถึงลูกค้าผู้รับชำระเงิน (ต้องตรงกับ CustomerRef ใน Invoice) | | TotalAmt | BigDecimal | ยอดรวมของการชำระเงิน | | UnappliedAmt | Decimal | ยอดเงินที่ยังไม่ได้ใช้หักไปกับ Invoice ใดๆ (เป็น “เครดิต” ของลูกค้า) | | PrivateNote | String | หมายเหตุส่วนตัวของ Payment | | PaymentMethodRef | ReferenceType | รหัสวิธีการชำระเงิน (เช่น เช็ค บัตรเครดิต ฯลฯ) | | Line \[0..n] | Line | รายละเอียดการชำระยอด จำนวนเงินที่ใช้หักแต่ละ Invoice, และการเชื่อมโยงธุรกรรมอื่นๆ | >[!Note] >ข้างต้นเป็นเพียงแค่บาง ATTRIBUTES ที่สำคัญเท่านั้น สามารถดูทั้งหมดได้ที่ [Official Doc](https://developer.intuit.com/app/developer/qbo/docs/api/accounting/all-entities/payment#the-payment-object "Official Doc") --- ### Create a payment https://developer.intuit.com/app/developer/qbo/docs/api/accounting/all-entities/payment#create-a-payment **Request URL** ``` POST /v3/company/<realmID>/payment Content type:application/json Production Base URL:https://quickbooks.api.intuit.com Sandbox Base URL:https://sandbox-quickbooks.api.intuit.com ``` **Request Body** | ATTRIBUTES Name | Require | Type | Description | | --------------- | --- | --------------- | ----------- | | TotalAmt | Required | Decimal | ยอดรวมของการชำระเงิน | | CustomerRef | Required | ReferenceType | อ้างอิงไปยังลูกค้าที่รับชำระเงิน | | ProjectRef | Conditionally required | ReferenceType | อ้างอิงไปยัง Project (ถ้ามี) ที่เชื่อมโยงกับรายการนี้ | | CurrencyRef | Conditionally required | CurrencyRefType | สกุลเงินของการชำระเงิน (ใช้เมื่อเปิดใช้งาน Multicurrency) | ตัวอย่าง Request Body ```json { "TotalAmt": 25.0, "CustomerRef": { "value": "20" } } ``` ตัวอย่าง Returns ```json { "Payment": { "SyncToken": "0", "domain": "QBO", "DepositToAccountRef": { "value": "4" }, "UnappliedAmt": 25.0, "TxnDate": "2014-12-30", "TotalAmt": 25.0, "ProjectRef": { "value": "39298034" }, "ProcessPayment": false, "sparse": false, "Line": [], "CustomerRef": { "name": "Red Rock Diner", "value": "20" }, "Id": "154", "MetaData": { "CreateTime": "2014-12-30T10:26:03-08:00", "LastUpdatedTime": "2014-12-30T10:26:03-08:00" } }, "time": "2014-12-30T10:26:03.668-08:00" } ``` --- ### Void a payment https://developer.intuit.com/app/developer/qbo/docs/api/accounting/all-entities/payment#void-a-payment การยกเลิกการชำระเงิน (Void) โดยไม่ลบข้อมูลออกจากระบบ โดยระบบจะเปลี่ยนทุก `ATTRIBUTES` ที่เกี่ยวกับจำนวนเงินเป็น 0 ทั้งหมด **Request URL** ``` POST /v3/company/<realmID>/payment?operation=update&include=void Content type:application/json Production Base URL:https://quickbooks.api.intuit.com Sandbox Base URL:https://sandbox-quickbooks.api.intuit.com ``` **Request Body** | ATTRIBUTES | Require | Type | Description | | ---------- | -------- | ------ | -------------------------------------------------------------------------------- | | SyncToken | Required | String | Token ใช้สำหรับการ track version ของ object นี้ต้องค่าล่าสุดจึงจะสามารถ Void ได้ | | id | Required | String | Id ของ Payment | | sparse | Required | String | ต้อง set เป็น `True` เพื่อการ void | ตัวอย่าง Request Body ```json { "SyncToken": "1", "Id": "33", "sparse": true } ``` ตัวอย่าง Returns ```json { "Payment": { "CustomerRef": { "value": "58", "name": "Xun Flowerrr" }, "DepositToAccountRef": { "value": "4" }, "TotalAmt": 0, "UnappliedAmt": 0, "ProcessPayment": false, "domain": "QBO", "sparse": false, "Id": "247", "SyncToken": "1", "MetaData": { "CreateTime": "2025-05-27T01:58:18-07:00", "LastUpdatedTime": "2025-05-27T01:58:23-07:00" }, "TxnDate": "2025-05-26", "CurrencyRef": { "value": "USD", "name": "United States Dollar" }, "PrivateNote": "Voided", "Line": [] }, "time": "2025-05-27T01:58:23.115-07:00" } ``` >[!Note] >จากตัวอย่าง Attribute อย่าง `TotalAmt` จะถูกเปลี่ยนเป็น 0 ## การเชื่อม Payment กับ Invoice ### การสร้าง Payment ที่เชื่อมกับ Invoice การเชื่อมโยงการชำระเงิน (Payment) เข้ากับใบแจ้งหนี้ (Invoice) ใน QuickBooks สามารถทำได้โดยการระบุรายการของใบแจ้งหนี้ที่ต้องการชำระภายใน `Payment.Line` และใช้ `LinkedTxn` เพื่ออ้างอิงถึงใบแจ้งหนี้นั้นๆ ตัวอย่างของการ Create Payment Body ที่จ่าย Invoice ```json { "CustomerRef": { "value": "58" }, "Line": [ { "Amount": 100.0, "LinkedTxn": [ { "TxnId": "248", "TxnType": "Invoice" } ] } ], "TotalAmt": 100.0, "TxnDate": "2025-05-26" } ``` >[!Note] >`TxnId` เป็น Reference ไปยัง Id ของ Invoice โดยต้องระบุ `TxnType` เป็น `Invoice` ตัวอย่าง Returns ```json { "Payment": { "CustomerRef": { "value": "58", "name": "Xun Flowerrr" }, "DepositToAccountRef": { "value": "4" }, "TotalAmt": 100.00, "UnappliedAmt": 0, "ProcessPayment": false, "domain": "QBO", "sparse": false, "Id": "249", "SyncToken": "0", "MetaData": { "CreateTime": "2025-05-27T02:20:09-07:00", "LastUpdatedTime": "2025-05-27T02:20:09-07:00" }, "TxnDate": "2025-05-26", "CurrencyRef": { "value": "USD", "name": "United States Dollar" }, "Line": [ { "Amount": 100.00, "LinkedTxn": [ { "TxnId": "248", "TxnType": "Invoice" } ], "LineEx": { "any": [ { "name": "{http://schema.intuit.com/finance/v3}NameValue", "declaredType": "com.intuit.schema.finance.v3.NameValue", "scope": "javax.xml.bind.JAXBElement$GlobalScope", "value": { "Name": "txnId", "Value": "248" }, "nil": false, "globalScope": true, "typeSubstituted": false }, { "name": "{http://schema.intuit.com/finance/v3}NameValue", "declaredType": "com.intuit.schema.finance.v3.NameValue", "scope": "javax.xml.bind.JAXBElement$GlobalScope", "value": { "Name": "txnOpenBalance", "Value": "100.00" }, "nil": false, "globalScope": true, "typeSubstituted": false }, { "name": "{http://schema.intuit.com/finance/v3}NameValue", "declaredType": "com.intuit.schema.finance.v3.NameValue", "scope": "javax.xml.bind.JAXBElement$GlobalScope", "value": { "Name": "txnReferenceNumber", "Value": "1091" }, "nil": false, "globalScope": true, "typeSubstituted": false } ] } } ] }, "time": "2025-05-27T02:20:08.520-07:00" } ``` ### การ Void Payment หรือ Invoice ที่มีการเชื่อมกันอยู่ มีเหตุการณ์อยู่ 2 กรณี 1. Invoice หนึ่งมี Payment เชื่อมอยู่และเกิดการ Void Payment 2. Invoice หนึ่งมี Payment เชื่อมอยู่และเกิดการ Void Invoice --- #### **1. Invoice หนึ่งมี Payment เชื่อมอยู่และเกิดการ Void Payment** เมื่อมีการ Void Payment ที่เชื่อมโยงกับ Invoice ใด ๆ ระบบจะดำเนินการดังนี้: - ยอดชำระ `TotalAmt` และยอดที่ยังไม่ได้ใช้ `UnappliedAmt` ของ Payment จะถูกตั้งค่าเป็น 0 - การเชื่อมโยง `LinkedTxn` ระหว่าง Payment และ Invoice จะถูกลบออก - ยอดค้างชำระ `Balance` ของ Invoice จะเพิ่มขึ้นตามจำนวนเงินที่ถูก Void >[!Note] Example >หาก Invoice มียอดรวม $100 และมีการชำระเงิน $50 ผ่าน Payment ที่เชื่อมโยงกัน เมื่อ Void Payment ดังกล่าว ยอดค้างชำระของ Invoice จะกลับมาเป็น $100 --- #### **2. Invoice หนึ่งมี Payment เชื่อมอยู่และเกิดการ Void Invoice** เมื่อมีการ Void Invoice ที่มี Payment เชื่อมโยงอยู่ ระบบจะดำเนินการดังนี้: - ยอดรวม `TotalAmt` และยอดค้างชำระ `Balance` ของ Invoice จะถูกตั้งค่าเป็น 0 - การเชื่อมโยง `LinkedTxn` ระหว่าง Invoice และ Payment จะถูกลบออก - ยอดที่ยังไม่ได้ใช้ `UnappliedAmt` ของ Payment จะเพิ่มขึ้นตามจำนวนเงินที่เคยเชื่อมโยงกับ Invoice >[!Note] Example >หาก Invoice มียอดรวม $100 และมีการชำระเงิน $100 ผ่าน Payment ที่เชื่อมโยงกัน เมื่อ Void Invoice ดังกล่าว ยอดที่ยังไม่ได้ใช้ของ Payment จะกลายเป็น $100 และสามารถนำไปใช้กับ Invoice อื่นได้ ## Response ใน case ต่างๆ ### Create Customer Success `200 OK` ```json { "Customer": { "Taxable": true, "Job": false, "BillWithParent": false, "Balance": 0, "BalanceWithJobs": 0, "CurrencyRef": { "value": "USD", "name": "United States Dollar" }, "PreferredDeliveryMethod": "Print", "IsProject": false, "domain": "QBO", "sparse": false, "Id": "60", "SyncToken": "0", "MetaData": { "CreateTime": "2025-06-02T09:44:08-07:00", "LastUpdatedTime": "2025-06-02T09:44:08-07:00" }, "FullyQualifiedName": "John Dave", "DisplayName": "John Dave", "PrintOnCheckName": "John Dave", "Active": true, "DefaultTaxCodeRef": { "value": "2" } }, "time": "2025-06-02T09:44:07.887-07:00" } ``` ### Create a customer failed (duplicate name) `400 Bad Request` ```json { "Fault": { "Error": [ { "Message": "Duplicate Name Exists Error", "Detail": "The name supplied already exists. : null", "code": "6240" } ], "type": "ValidationFault" }, "time": "2025-06-02T09:45:16.445-07:00" } ``` ### Create a Item success `200 OK` ```json { "Item": { "Name": "Test Item", "Active": true, "FullyQualifiedName": "Test Item", "Taxable": false, "UnitPrice": 15, "Type": "NonInventory", "IncomeAccountRef": { "value": "79", "name": "Sales of Product Income" }, "PurchaseCost": 0, "TrackQtyOnHand": false, "DeferredRevenue": false, "domain": "QBO", "sparse": false, "Id": "19", "SyncToken": "0", "MetaData": { "CreateTime": "2025-06-02T09:56:25-07:00", "LastUpdatedTime": "2025-06-02T09:56:25-07:00" } }, "time": "2025-06-02T09:56:25.173-07:00" } ``` ### Create a Item failed (duplicate name) `400 Bad Request` ```json { "Fault": { "Error": [ { "Message": "Duplicate Name Exists Error", "Detail": "The name supplied already exists. : Id=19", "code": "6240" } ], "type": "ValidationFault" }, "time": "2025-06-02T09:57:22.105-07:00" } ``` ### Create invoice success `200 OK` ```json { "Invoice": { "AllowIPNPayment": false, "AllowOnlinePayment": false, "AllowOnlineCreditCardPayment": false, "AllowOnlineACHPayment": false, "domain": "QBO", "sparse": false, "Id": "251", "SyncToken": "0", "MetaData": { "CreateTime": "2025-06-02T09:59:40-07:00", "LastModifiedByRef": { "value": "9341454710333993" }, "LastUpdatedTime": "2025-06-02T09:59:40-07:00" }, "CustomField": [], "DocNumber": "1093", "TxnDate": "2025-05-26", "CurrencyRef": { "value": "USD", "name": "United States Dollar" }, "LinkedTxn": [], "Line": [ { "Id": "1", "LineNum": 1, "Amount": 100.00, "DetailType": "SalesItemLineDetail", "SalesItemLineDetail": { "ItemRef": { "value": "19", "name": "Test Item" }, "ItemAccountRef": { "value": "79", "name": "Sales of Product Income" }, "TaxCodeRef": { "value": "NON" } } }, { "Amount": 100.00, "DetailType": "SubTotalLineDetail", "SubTotalLineDetail": {} } ], "TxnTaxDetail": { "TotalTax": 0 }, "CustomerRef": { "value": "58", "name": "Xun Flowerrr" }, "BillAddr": { "Id": "134" }, "ShipAddr": { "Id": "134" }, "FreeFormAddress": true, "ShipFromAddr": { "Id": "163", "Line1": "123 Sierra Way", "Line2": "San Pablo, CA 87999" }, "DueDate": "2025-06-25", "TotalAmt": 100.00, "ApplyTaxAfterDiscount": false, "PrintStatus": "NeedToPrint", "EmailStatus": "NotSet", "Balance": 100.00 }, "time": "2025-06-02T09:59:40.043-07:00" } ``` ### Create invoice failed (missing item id) `400 Bad Request` ```json { "Fault": { "Error": [ { "Message": "Required param missing, need to supply the required value for the API", "Detail": "Required parameter Line.SalesItemLineDetail is missing in the request", "code": "2020", "element": "Line.SalesItemLineDetail" } ], "type": "ValidationFault" }, "time": "2025-06-02T10:00:47.515-07:00" } ``` ### Create invoice failed (not found item id) `400 Bad Request` ```json { "Fault": { "Error": [ { "Message": "Invalid Reference Id", "Detail": "Invalid Reference Id : Line.SalesItemLineDetail.ItemRef", "code": "2500", "element": "Line.SalesItemLineDetail.ItemRef" } ], "type": "ValidationFault" }, "time": "2025-06-02T10:01:26.595-07:00" } ``` ### Create invoice failed (missing customer id) example request body ```json { "Line": [ { "DetailType": "SalesItemLineDetail", "Amount": 100.0, "SalesItemLineDetail": { "ItemRef": { "value": "{{itemId}}", "name": "Test Item" } } } ], "CustomerRef": { }, "TxnDate": "2025-05-26" } ``` response `400 Bad Request` ```json { "Fault": { "Error": [ { "Message": "CustomerRef is required", "Detail": "CustomerRef is missing in the request", "code": "6560", "element": "Invoice" } ], "type": "ValidationFault" }, "time": "2025-06-02T10:09:43.275-07:00" } ``` ### Create invoice failed (missing customer id but with customer name) example request body ```json { "Line": [ { "DetailType": "SalesItemLineDetail", "Amount": 100.0, "SalesItemLineDetail": { "ItemRef": { "value": "{{itemId}}", "name": "Test Item" } } } ], "CustomerRef": { "name": "Xun Flowerrr" }, "TxnDate": "2025-05-26" } ``` response `400 Bad Request` ```json { "Fault": { "Error": [ { "Message": "An application error has occurred while processing your request", "Detail": "System Failure Error: java.lang.NumberFormatException: null", "code": "10000", "element": "SystemFailureError" } ], "type": "SystemFault" }, "time": "2025-06-02T10:11:13.765-07:00" } ``` ### Create invoice failed (cutomer id is empty string) example request body ```json { "Line": [ { "DetailType": "SalesItemLineDetail", "Amount": 100.0, "SalesItemLineDetail": { "ItemRef": { "value": "{{itemId}}", "name": "Test Item" } } } ], "CustomerRef": { "name": "Xun Flowerrr", "value": "" }, "TxnDate": "2025-05-26" } ``` response `400 Bad Request` ```json { "Fault": { "Error": [ { "Message": "An application error has occurred while processing your request", "Detail": "System Failure Error: java.lang.NumberFormatException: For input string: \"\"", "code": "10000", "element": "SystemFailureError" } ], "type": "SystemFault" }, "time": "2025-06-02T10:12:36.479-07:00" } ``` ### Create invoice failed (customer id is not found) example request body ```json { "Line": [ { "DetailType": "SalesItemLineDetail", "Amount": 100.0, "SalesItemLineDetail": { "ItemRef": { "value": "{{itemId}}", "name": "Test Item" } } } ], "CustomerRef": { "value": "9999" }, "TxnDate": "2025-05-26" } ``` response `400 Bad Request` ```json { "Fault": { "Error": [ { "Message": "Invalid Reference Id", "Detail": "Invalid Reference Id : Names element id 9999 not found", "code": "2500", "element": "Reference Id" } ], "type": "ValidationFault" }, "time": "2025-06-02T10:14:14.733-07:00" } ``` ### create payment success `200 OK` ```json { "Payment": { "CustomerRef": { "value": "58", "name": "Xun Flowerrr" }, "DepositToAccountRef": { "value": "4" }, "TotalAmt": 100.00, "UnappliedAmt": 0, "ProcessPayment": false, "domain": "QBO", "sparse": false, "Id": "256", "SyncToken": "0", "MetaData": { "CreateTime": "2025-06-02T10:23:13-07:00", "LastUpdatedTime": "2025-06-02T10:23:13-07:00" }, "TxnDate": "2025-05-26", "CurrencyRef": { "value": "USD", "name": "United States Dollar" }, "Line": [ { "Amount": 100.00, "LinkedTxn": [ { "TxnId": "255", "TxnType": "Invoice" } ], "LineEx": { "any": [ { "name": "{http://schema.intuit.com/finance/v3}NameValue", "declaredType": "com.intuit.schema.finance.v3.NameValue", "scope": "javax.xml.bind.JAXBElement$GlobalScope", "value": { "Name": "txnId", "Value": "255" }, "nil": false, "globalScope": true, "typeSubstituted": false }, { "name": "{http://schema.intuit.com/finance/v3}NameValue", "declaredType": "com.intuit.schema.finance.v3.NameValue", "scope": "javax.xml.bind.JAXBElement$GlobalScope", "value": { "Name": "txnOpenBalance", "Value": "100.00" }, "nil": false, "globalScope": true, "typeSubstituted": false }, { "name": "{http://schema.intuit.com/finance/v3}NameValue", "declaredType": "com.intuit.schema.finance.v3.NameValue", "scope": "javax.xml.bind.JAXBElement$GlobalScope", "value": { "Name": "txnReferenceNumber", "Value": "1097" }, "nil": false, "globalScope": true, "typeSubstituted": false } ] } } ] }, "time": "2025-06-02T10:23:12.807-07:00" } ``` ### create payment failed (missing customer id) example request body ```json { "CustomerRef": { }, "Line": [ { "Amount": 100.0, "LinkedTxn": [ { "TxnId": "{{invoiceId}}", "TxnType": "Invoice" } ] } ], "TotalAmt": 100.0, "TxnDate": "2025-05-26" } ``` response `400 Bad Request` ```json { "Fault": { "Error": [ { "Message": "Required param missing, need to supply the required value for the API", "Detail": "Required parameter CustomerRef is missing in the request", "code": "2020", "element": "CustomerRef" } ], "type": "ValidationFault" }, "time": "2025-06-02T10:24:21.128-07:00" } ``` ### create payment failed (missing customer id but with customer name) example request body ```json { "CustomerRef": { "name": "Xun Flowerrr" }, "Line": [ { "Amount": 100.0, "LinkedTxn": [ { "TxnId": "{{invoiceId}}", "TxnType": "Invoice" } ] } ], "TotalAmt": 100.0, "TxnDate": "2025-05-26" } ``` response `400 Bad Request` ```json { "Fault": { "Error": [ { "Message": "Required param missing, need to supply the required value for the API", "Detail": "Required parameter CustomerRef is missing in the request", "code": "2020", "element": "CustomerRef" } ], "type": "ValidationFault" }, "time": "2025-06-02T10:25:48.059-07:00" } ``` ### create payment failed (customer id is empty string) example request body ```json { "CustomerRef": { "value": "" }, "Line": [ { "Amount": 100.0, "LinkedTxn": [ { "TxnId": "{{invoiceId}}", "TxnType": "Invoice" } ] } ], "TotalAmt": 100.0, "TxnDate": "2025-05-26" } ``` response `400 Bad Request` ```json { "Fault": { "Error": [ { "Message": "Required param missing, need to supply the required value for the API", "Detail": "Required parameter CustomerRef is missing in the request", "code": "2020", "element": "CustomerRef" } ], "type": "ValidationFault" }, "time": "2025-06-02T10:27:25.920-07:00" } ``` ### create payment failed (customer id is not found) example request body ```json { "CustomerRef": { "value": "9999" }, "Line": [ { "Amount": 100.0, "LinkedTxn": [ { "TxnId": "{{invoiceId}}", "TxnType": "Invoice" } ] } ], "TotalAmt": 100.0, "TxnDate": "2025-05-26" } ``` response `400 Bad Request` ```json { "Fault": { "Error": [ { "Message": "Invalid Reference Id", "Detail": "Invalid Reference Id : Names element id 9999 not found", "code": "2500", "element": "Reference Id" } ], "type": "ValidationFault" }, "time": "2025-06-02T10:28:59.408-07:00" } ``` ### create payment failed (missing invoice id) example request body ```json { "CustomerRef": { "value": "58" }, "Line": [ { "Amount": 100.0, "LinkedTxn": [ { "TxnType": "Invoice" } ] } ], "TotalAmt": 100.0, "TxnDate": "2025-05-26" } ``` response `400 Bad Request` ```json { "Fault": { "Error": [ { "Message": "Required param missing, need to supply the required value for the API", "Detail": "Required parameter LinkedTxn.TxnId is missing in the request", "code": "2020", "element": "LinkedTxn.TxnId" } ], "type": "ValidationFault" }, "time": "2025-06-02T10:30:07.020-07:00" } ``` ### create payment failed (invoice id is empty string) example request body ```json { "CustomerRef": { "value": "58" }, "Line": [ { "Amount": 100.0, "LinkedTxn": [ { "TxnId": "", "TxnType": "Invoice" } ] } ], "TotalAmt": 100.0, "TxnDate": "2025-05-26" } ``` response `400 Bad Request` ```json { "Fault": { "Error": [ { "Message": "Invalid ID", "Detail": "Id should be a valid number. Supplied value:", "code": "2030", "element": "LinkedTxn.TxnId" } ], "type": "ValidationFault" }, "time": "2025-06-02T10:30:40.722-07:00" } ``` ### create payment failed (invoice id is not found) example request body ```json { "CustomerRef": { "value": "58" }, "Line": [ { "Amount": 100.0, "LinkedTxn": [ { "TxnId": "9999", "TxnType": "Invoice" } ] } ], "TotalAmt": 100.0, "TxnDate": "2025-05-26" } ``` response `400 Bad Request` ```json { "Fault": { "Error": [ { "Message": "Object Not Found", "Detail": "Object Not Found : Something you're trying to use has been made inactive. Check the fields with accounts, customers, items, vendors or employees.", "code": "610", "element": "" } ], "type": "ValidationFault" }, "time": "2025-06-02T10:31:26.562-07:00" } ```