VitePOS Bridge icon

VitePOS Bridge

Use VitePOS automation bridge and analytics APIs

Purchase → Create Purchase

AI-generated

Summary

Creates a purchase order in VitePOS through the bridge endpoint POST /wp-json/vtab/v1/purchases/create, using either field-based inputs or a raw JSON body.

Inputs

  • Input Mode — 'Use Fields' (default) builds the request body from the Purchase Fields and Purchase Items. 'Advanced JSON' sends the JSON Body as-is.
  • JSON Body — Shown only in Advanced JSON mode. Sent unchanged as the request body (default {"dry_run": true}). Must be valid JSON or the node errors.
  • Purchase Fields — Optional collection of header fields: external_id, warehouse_id, purchase_date, purchase_note, status (Active/Draft), payment_status (Paid/Due/Partial), order_tax, tax_type, discount, discount_type, shipping_cost, other_expense, and dry_run. Only fields you add are sent.
  • Purchase Fields: Vendor — Vendor ID is sent as vendor_id if set. Otherwise, if Vendor Name, Email or External ID is set, a vendor object is sent with phone as contact_no. It also carries create_if_missing from 'Create Vendor If Missing', which is false if the field isn't added to the collection.
  • Purchase Items — Repeatable line items: product_id, variation_id, sku, quantity, purchase_cost, sale_price, barcode, add_to_list, batch_id, batch_no, batch_qty, expiry_date. Items with no values are dropped.

Output shape

One output item per input item. Its JSON is the bridge API response with a human-readable 'response' string added at the top, for example 'Purchase order 123 was created successfully.'

The summary uses purchase_id, id or purchaseId from the response and falls back to 'Purchase request completed.' If the API returns status/success false, 'response' holds its message. If the API response already has a 'response' key, it is nested under 'raw'. With Continue On Fail, failed items return {error: message}. Dry Run is passed to the bridge, so what it returns depends on the bridge.

Examples

Example 1: Record a stock delivery from a known vendor

Fields mode; Vendor ID=12, Warehouse ID=1, Payment Status=Paid; one item with Product ID, Quantity=10, Purchase Cost=5.5.

Example 2: Preview a purchase with a new vendor and batch/expiry data

Fields mode; Vendor Name + Email, Create Vendor If Missing=true, Dry Run=true; item with SKU, Quantity, Batch No, Expiry Date, Batch Quantity.

Example 3: Send a custom payload built upstream

Input Mode=Advanced JSON; JSON Body set to an expression containing the full purchase payload.

Links

Discussion