Create purchase order
create_purchase_orderAdds a purchase order, which is an order submitted to a vendor. You can use ItemReceiptAdd to receive items against a purchase order as items arrive from the vendor. A purchase order is a non-posting transaction, so it doesn’t affect a company’s balance sheet or income statement.
The purchase_order_add wrapper from qbXML is also accepted. Returns the v2 request to send, and the webhook payload QuickBooks' answer arrives in (this operation's response_json: its data shape and the status codes to handle).
Possible errors (error.code / error.type; the call result explains each): 1030 unsupported_request, 3000 invalid_object_id, 3040 invalid_amount, 3070 string_too_long, 3120 object_not_found, 3140 invalid_reference, 3150 missing_element, 3175 in_use, 3176 locked, 3180 cannot_save, 3210 invalid_value, 3220 not_authorized, 3231 request_not_processed, 3250 feature_not_enabled, 3260 insufficient_permission, 3261 personal_data_access_denied, 3262 payroll_subscription_required, 3263 read_only_access, 3264 merchant_services_subscription_required, 3270 missing_posting_account
Tool call template
This tool declares no required parameters. Add optional parameters from the input schema as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {},
"name": "create_purchase_order"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| fob | No | QuickBooks uses the term FOB, “freight on board,” to indicate the place from which the product is shipped. The FOB has no accounting implications. | |
| memo | No | This can be included in reports, but it doesn’t appear on the printed purchase order. | |
| other1 | No | Other, Other1, and Other2 are built-in transaction custom fields. Other is transaction-level; Other1 and Other2 are line-level. | |
| other2 | No | Other, Other1, and Other2 are built-in transaction custom fields. Other is transaction-level; Other1 and Other2 are line-level. | |
| due_date | No | The date on which payment is due. | |
| txn_date | No | The date of the transaction. In some cases, if you leave `txn_date` out of an -Add message, QuickBooks will prefill `txn_date` with the date of the last-saved transaction of the same type. | |
| class_ref | No | Use classes to categorize transactions (for example, by department, location, or work type). Class tracking is off by default in QuickBooks. | |
| def_macro | No | `def_macro` lets you assign a reusable name to a returned `txn_id` or `txn_line_id` so later requests can reference it with `useMacro`. This feature requires SDK 2.0+. | |
| terms_ref | No | Refers to the payment terms associated with this entity. (This will be an item on the DateDrivenTerms or StandardTerms list.) | |
| ref_number | No | `ref_number` is a user-managed transaction reference (for example, a check number). It can be edited and is not guaranteed to be globally unique. | |
| request_id | No | Your own label for the request, sent to QuickBooks as its qbXML `requestID` and echoed in the raw answer (`response_xml`); optional, since the answer's webhook already carries the request's `id`. | |
| vendor_msg | No | Message to be printed on a purchase order for the vendor to read. | |
| vendor_ref | No | A vendor is any person or company from whom a small business owner buys goods and services. (Banks and tax agencies usually are included on the vendor list.) | |
| ship_address | No | This aggregate supports at most five address lines. You can provide a structured address (Addr1-Addr3 plus City/State/`postal_code`/etc.) or use block mode (Addr1-Addr5 only). | |
| template_ref | No | QuickBooks templates specify how to print certain transactions. A template query returns the names of all templates that have been defined in QuickBooks. | |
| exchange_rate | No | `exchange_rate` is the rate from this currency to the company’s home currency at AsOfDate. You can supply a rate when adding transactions, but QuickBooks does not provide rates through the SDK. | |
| expected_date | No | The date on which shipment is expected. | |
| external_guid | No | Allows for the attachment of a user defined GUID value. | |
| include_qbxml | No | Also return the qbXML this compiles to, for debugging. Not part of the v2 request. | |
| vendor_address | No | If an address request fails, some combination of address fields might be too long. | |
| is_tax_included | No | For future use with international versions of QuickBooks. | |
| ship_method_ref | No | A shipping method, for example, standard mail or overnight delivery. A `ship_method_ref` aggregate refers to an item on the ShipMethod list. | |
| is_to_be_emailed | No | When enabled, QuickBooks validates the customer email at runtime before sending. If no valid email is available, the request fails. | |
| is_to_be_printed | No | If `is_to_be_printed` is true, QuickBooks queues the form for later printing. It does not print immediately; printing is still a user action in QuickBooks. | |
| inventory_site_ref | No | Site where inventory is located. Choose at most one of: `inventory_site_ref`, or `ship_to_entity_ref`. | |
| sales_tax_code_ref | No | `sales_tax_code_ref` points to the sales-tax code used for an item or customer context. QuickBooks includes default TAX and NON codes, and a code can be deleted only when nothing references it. | |
| ship_to_entity_ref | No | Refers to a customer, vendor, employee, or person on the “other names” list to whom this order is to be shipped. Choose at most one of: `inventory_site_ref`, or `ship_to_entity_ref`. | |
| include_ret_element | No | ||
| purchase_order_line_add | No | One line of the purchase order. Compare with PurchaseOrderLineGroup, which represents a previously defined group of lines in the purchase order. At least one entry is required across `purchase_order_line_add` and `purchase_order_line_group_add`; they combine, any number of each. QuickBooks receives them in that order: every `purchase_order_line_add`, then every `purchase_order_line_group_add`. | |
| purchase_order_line_group_add | No | Represents a previously defined group of lines in the purchase order. Compare with PurchaseOrderLine, which represents just one line in the purchase order. At least one entry is required across `purchase_order_line_add` and `purchase_order_line_group_add`; they combine, any number of each. QuickBooks receives them in that order: every `purchase_order_line_add`, then every `purchase_order_line_group_add`. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| url | Yes | Replace {connection_id} with the customer's connection. | |
| body | Yes | The JSON body: the arguments you passed. | |
| qbxml | No | The qbXML it compiles to. Only with include_qbxml. | |
| method | Yes | ||
| headers | Yes | Send with the request. Resent unchanged when no 201 came back, it answers with the request already queued. | |
| webhook | Yes | JSON Schema of the payload POSTed to webhook_url once QuickBooks answers, with this operation's response_json (data shape and status codes). |