Correct a receipt
Corrects received or rejected counts, rejection reasons, vendor unit costs and receipt charges, adds missed items through add_lines and returns the correction details; one reason covers the changes, and Shopify stock updates follow in the background. Returns 409 PURCHASE_ORDER_STALE if the receipt changed since expected_updated_at; reopen a finalized purchase order before correcting its receipt.
Required access
- API key
- Any ofManage purchase ordersEnter and correct costspermissions
- Request limit
- Counts as 5 requests. Each key has a capacity of 15, restored at 0.6 a second.
Idempotent-Replayed: true. Responses are saved for 24 hours.Headers
Bearer and your key, opk_….
Up to 100 characters (letters, digits, - _ : .). Kept for 24 hours.
application/json. A body is at most 256 KB.
Parameters
The purchase order’s id.
The receipt’s id from GET /purchase-orders/{id}/receipts.
Body
JSONItems that arrived with this delivery but were missed at check-in.
A purchase order line not yet on this receipt.
When the cost was typed as the line’s total, that total (for the history).
The vendor’s price per unit; left out or null, the purchase order’s price. A real change needs “Correct received costs” (a key: Enter and correct costs); sent without “View costs” it is refused.
The receipt’s own charges to add (no id), change (id; the fields sent replace the charge’s, and a missing description or reference is cleared) or remove (id and remove: true). Any charge needs “Correct received costs” (a key: Enter and correct costs) and “View costs”.
Zero or more, two decimals.
Expensed, not in item cost. Left out, a charge keeps how it is treated, a new one is split by value.
A charge’s id from the receipt.
Lines of this receipt it lands on; empty or left out: every line.
The purchase order line’s id.
One option on that line.
The option’s vendor cost per unit, which a split by value over options needs. Only with “View costs”.
Any casing is accepted.
One of inbound_shipping, duty_import, brokerage, insurance, handling, tariff, other.
The receipt’s updated_at as you last read it, when you don’t send version. A receipt changed since is 409 PURCHASE_ORDER_STALE.
Lines already on the receipt that change.
A line’s id from the receipt.
What this receipt received of the line, corrected.
Required when rejected units rise.
When the cost was typed as the line’s total, that total (for the history).
The vendor’s price per unit on this receipt, zero or more. A real change needs “Correct received costs” (a key: Enter and correct costs); sent without “View costs” it is refused.
Why the receipt is changing. Required.
The version of the last answer about this record (the receipt in GET /purchase-orders/{id}/receipts, or the last correction), sent back exactly as it is: no read needed first. A change made since is refused (409) with the current version and what changed. Send this or expected_updated_at.
Returns
OK: changes, costs_hidden, id, inventory_update_summary, purchase_order_id, purchase_order_status, receipt_number, updated_at, version
Errors
Errors use { "error": { "code", "message" } }. Use code to handle the error. View all error codes.
The request isn’t valid (see error.code), or the API version isn’t supported.
No valid access token or API key.
The store’s subscription isn’t active.
Not allowed: the API is off for this store, or the caller lacks the scope or permission.
Not found, or not visible to this caller.
Wrong method for this path; Allow lists every method the path takes.
The request body didn’t arrive in time.
The same Idempotency-Key is still being processed (REQUEST_IN_PROGRESS), its outcome is unknown (OUTCOME_UNKNOWN: check the record), or the record changed since it was read.
The request body is too large.
The request is valid JSON but can’t be done (a rule of the store refuses it), or the Idempotency-Key was used with a different body.
The app is older than the oldest version still served (error.code CLIENT_TOO_OLD); see error.min_version and error.upgrade_url.
Over a rate limit; wait Retry-After seconds.
Something went wrong on our side. A write may have partly happened: check the record before retrying it.
Busy, switched off, or billing couldn’t be checked; wait Retry-After seconds.