What this guide covers
The purchase-to-pay (P2P) workflow moves goods and money through four stages:- Purchase order — commit to buying from a vendor
- Goods receipt — receive the goods into inventory
- Vendor bill — record the vendor’s invoice and clear the GRNI accrual
- AP payment — pay the bill and close the liability
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.
po.data.id (the PO UUID). You will reference it in later stages.
Confirm the PO (open it)
Once reviewed, transition toopen 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.
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
draft status. No GL entry yet.
Post the bill
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.
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: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, includevendor_credit_ids[] in the payment body:
Common errors
Idempotency
Every write in this flow acceptsIdempotency-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
- Journal Entries and Period Close — record adjusting entries and close the accounting period
- Creating Orders — build a sales order on the outbound side
- API Reference: Purchase Orders
- API Reference: Vendor Bills
- API Reference: AP Payments

