curl --request POST \
--url https://api.exowpee.com/v1/catalog/purchase-deliveries/{purchaseDelivery}/confirm \
--header 'Authorization: Bearer <token>'import requests
url = "https://api.exowpee.com/v1/catalog/purchase-deliveries/{purchaseDelivery}/confirm"
headers = {"Authorization": "Bearer <token>"}
response = requests.post(url, headers=headers)
print(response.text)const options = {method: 'POST', headers: {Authorization: 'Bearer <token>'}};
fetch('https://api.exowpee.com/v1/catalog/purchase-deliveries/{purchaseDelivery}/confirm', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.exowpee.com/v1/catalog/purchase-deliveries/{purchaseDelivery}/confirm",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.exowpee.com/v1/catalog/purchase-deliveries/{purchaseDelivery}/confirm"
req, _ := http.NewRequest("POST", url, nil)
req.Header.Add("Authorization", "Bearer <token>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.exowpee.com/v1/catalog/purchase-deliveries/{purchaseDelivery}/confirm")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.exowpee.com/v1/catalog/purchase-deliveries/{purchaseDelivery}/confirm")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body{
"id": "<string>",
"type": "<string>",
"purchase_id": "<string>",
"cash_register_id": "<string>",
"reference": "<string>",
"status": "<string>",
"additional_cost_strategy": "<string>",
"delivery_rate_id": "<string>",
"delivery_fee": 123,
"delivery_fee_label": "<string>",
"delivery_fee_paid_by_company": true,
"purchase_cost_leftover": 123,
"received_at": "2023-11-07T05:31:56Z",
"expected_at": "2023-12-25",
"notes": "<string>",
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z",
"items": "<array>",
"costs": "<array>"
}Confirm a purchase delivery
Confirms goods were received: stock is added, the purchase lines are reduced and the purchase becomes completed when nothing remains.
curl --request POST \
--url https://api.exowpee.com/v1/catalog/purchase-deliveries/{purchaseDelivery}/confirm \
--header 'Authorization: Bearer <token>'import requests
url = "https://api.exowpee.com/v1/catalog/purchase-deliveries/{purchaseDelivery}/confirm"
headers = {"Authorization": "Bearer <token>"}
response = requests.post(url, headers=headers)
print(response.text)const options = {method: 'POST', headers: {Authorization: 'Bearer <token>'}};
fetch('https://api.exowpee.com/v1/catalog/purchase-deliveries/{purchaseDelivery}/confirm', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.exowpee.com/v1/catalog/purchase-deliveries/{purchaseDelivery}/confirm",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.exowpee.com/v1/catalog/purchase-deliveries/{purchaseDelivery}/confirm"
req, _ := http.NewRequest("POST", url, nil)
req.Header.Add("Authorization", "Bearer <token>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.exowpee.com/v1/catalog/purchase-deliveries/{purchaseDelivery}/confirm")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.exowpee.com/v1/catalog/purchase-deliveries/{purchaseDelivery}/confirm")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body{
"id": "<string>",
"type": "<string>",
"purchase_id": "<string>",
"cash_register_id": "<string>",
"reference": "<string>",
"status": "<string>",
"additional_cost_strategy": "<string>",
"delivery_rate_id": "<string>",
"delivery_fee": 123,
"delivery_fee_label": "<string>",
"delivery_fee_paid_by_company": true,
"purchase_cost_leftover": 123,
"received_at": "2023-11-07T05:31:56Z",
"expected_at": "2023-12-25",
"notes": "<string>",
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z",
"items": "<array>",
"costs": "<array>"
}purchase_deliveries.confirm
Conditions
- A reception that is already confirmed is refused with 409; confirmation happens once.
- The reception must have at least one line; otherwise the call is refused with 422.
- Every line is checked again at confirmation: its location asset must still be existing, active, available to the company and not restricted for the current member; its purchase line must still exist on the purchase with an active purchase unit; the quantity may not exceed what is still to receive on that purchase line; and the damage rules are re-applied. Errors are returned per line, keyed by the line identifier.
- The remaining quantity of each purchase line is reduced; if another confirmation already consumed it, the call is refused with 409.
- The reception can be confirmed from draft or in_transit. The purchase’s status is not checked at confirmation.
- Adds the accepted quantity of every line whose product is tracked to stock, in the location asset set on the line (asset_id), as a purchase stock entry linked to the purchase, the supplier, the reception and the purchase line. Untracked products add nothing to stock. A line with no accepted quantity (everything damaged) adds nothing.
- Each stock entry carries the line’s total cost, so the unit cost of the stock includes the spread extra costs.
- Spreads the extra costs of the reception and its delivery fee over the lines, with the reception’s additional_cost_strategy: average splits equally (remainder to the first lines), prorata splits in proportion to each line’s base cost (rounding remainder to the first line). With the purchase’s total cost strategy, the rounding leftover of the purchase not yet allocated by earlier confirmed receptions is also added to the lines and recorded on the reception as purchase_cost_leftover; the purchase’s own leftover is set back to 0.
- Records the damage cost of each damaged line; with the treatment “expensed” that cost is removed from the cost of the stock added, with “absorbed_by_remaining_stock” it stays in it. Fills base_cost_total, allocated_purchase_leftover, allocated_landed_cost_total, damage_cost_total, accepted_quantity and cost_total on each line.
- Decrements the remaining quantity of each purchase line by the received quantity (accepted plus damaged).
- Sets the reception to confirmed and received_at to now.
- Sets the purchase to pending while some line still has a remaining quantity, otherwise to completed.
- When the delivery has a fee above 0 that is not paid by the company (delivery_fee_paid_by_company is false), the amount is added to what is owed to the supplier and the purchase’s amount paid, remaining amount and payment status are recalculated.
- The reception posts no cash movement and does not use cash_register_id.
Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Path Parameters
Identifier of the purchase delivery (27-character KSUID).
Query Parameters
Response mode. Default none; none answers 204 No Content.
none, resource Comma-separated JSON keys of the root resource (id is always rendered). Available: id, type, purchase_id, cash_register_id, reference, status, additional_cost_strategy, delivery_rate_id, delivery_fee, delivery_fee_label, delivery_fee_paid_by_company, purchase_cost_leftover, received_at, expected_at, notes, created_at, updated_at.
Comma-separated include paths, each optionally followed by its fields in parentheses: units(id,sku),units.uomUnit(id,name). Max depth 6, max 40 paths. Available: items, items.item, items.damageStockableUnit, costs.
Response
Resource (only with response=resource).
Identifier of the reception (27-character KSUID).
Kind of reception: "delivery" here. Set by the server from the route.
Identifier of the purchase this reception brings goods for. Set at creation and not changeable.
Cash register recorded on the reception, or null. It must belong to the current company and organization and have a cash account. It is only stored.
Optional free reference, unique among the company's receptions (pickups and deliveries together). Null when none.
State of the reception: draft (being prepared), in_transit (deliveries only: the supplier's truck is on its way, still editable) or confirmed (goods received, stock added). Set by the server.
How the extra costs are spread over the lines at confirmation: average (equally) or prorata (in proportion to each line's base cost).
Identifier of the supplier's predefined delivery rate the fee was copied from, or null for a custom fee or a free delivery.
Delivery fee in major units, copied from the rate or entered as a custom fee. Null when the delivery is free. It is added to the landed cost spread over the lines at confirmation.
Label of the delivery fee (copied from the rate, or custom), or null.
true (default) when the company pays the fee itself; false when the fee is owed to the supplier and added to the purchase's payable once the delivery is confirmed.
Rounding leftover of the purchase's cost that was added to this reception's lines at confirmation, in major units. 0 until the reception is confirmed.
Date and time of confirmation (ISO 8601). Null until the reception is confirmed.
Date the goods are expected (YYYY-MM-DD), or null.
Free notes, or null.
Date and time the record was created (ISO 8601, UTC).
Date and time the record was last changed (ISO 8601, UTC).
Lines of the reception. Present only when requested with include=items.
Extra costs of the reception. Present only when requested with include=costs.