Skip to main content

What this guide covers

The purchase-to-pay (P2P) workflow moves goods and money through four stages:
  1. Purchase order — commit to buying from a vendor
  2. Goods receipt — receive the goods into inventory
  3. Vendor bill — record the vendor’s invoice and clear the GRNI accrual
  4. AP payment — pay the bill and close the liability
Each stage is a separate API call. GL entries post automatically at the right stage. No manual journal entries are needed for the standard flow.

Prerequisites

  • API key with scopes: purchasing:write, purchasing:read, accounting:write
  • An active vendor account (account_type: vendor)
  • One or more product IDs to order
  • A warehouse location ID

Stage 1: Create the purchase order

POST /v1/orders with document_type: "purchase_order". The order is created in draft status. No GL entry fires at this stage.
Save po.data.id (the PO UUID). You will reference it in later stages.

Confirm the PO (open it)

Once reviewed, transition to open status, which makes it eligible for receiving:

Stage 2: Receive goods

POST /v1/orders/{po_id}/receive records the goods arriving at your warehouse. GL entries that fire at this stage: GRNI is a liability accrual that stays open until you post the vendor bill in Stage 3.
The response includes inventory_updated: true and the GL journal entry ID for the GRNI posting. Inventory on-hand increases immediately. Partial receipt: you can receive fewer than the ordered quantity. The remaining quantity stays open on the PO. Fire another receive call when the rest arrives.

Stage 3: Enter and post the vendor bill

When the vendor’s invoice arrives, create a vendor bill linked to the PO. Posting the bill clears the GRNI accrual and records the AP liability.

Create the draft bill

The bill is created in draft status. No GL entry yet.

Post the bill

GL entries that fire when the bill is posted: This clears the GRNI accrual from Stage 2. The AP liability is now open until Stage 4.

Stage 4: Pay the vendor bill

POST /v1/ap-payments closes the AP liability and records the outgoing cash.
GL entries that fire at payment: The AP liability is cleared. The vendor bill transitions to paid status.

GL summary: the full P2P transaction trail

At Stage 4, GRNI nets to zero and Inventory FG reflects the real cost. This is the standard accrual accounting pattern (NetSuite, Acumatica, QuickBooks Enterprise all follow the same sequence).

Partial payments and multi-bill payments

A single AP payment can apply to multiple bills:
You can also pay a bill partially. The bill remains open with a reduced balance_due until the remaining balance is paid or written off.

Vendor credits

To apply a vendor credit against a bill payment, include vendor_credit_ids[] in the payment body:
The credit reduces the cash portion of the payment. If credits fully cover the bill, no bank JE posts.

Common errors


Idempotency

Every write in this flow accepts Idempotency-Key. Use a stable key tied to your source record (e.g. po-<source-po-id>, recv-<source-receipt-id>, bill-<vendor-invoice-number>). Keys expire after 24 hours.

Verifying the full chain

After all four stages, run these checks:

Next steps