curl --request POST \
--url https://api.exowpee.com/v1/catalog/purchase-returns/{purchaseReturn}/confirm \
--header 'Authorization: Bearer <token>'import requests
url = "https://api.exowpee.com/v1/catalog/purchase-returns/{purchaseReturn}/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-returns/{purchaseReturn}/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-returns/{purchaseReturn}/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-returns/{purchaseReturn}/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-returns/{purchaseReturn}/confirm")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.exowpee.com/v1/catalog/purchase-returns/{purchaseReturn}/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>",
"purchase_id": "<string>",
"purchase_reception_id": "<string>",
"vendor_id": "<string>",
"reference": "<string>",
"status": "<string>",
"vat_total": 123,
"replacement_expected": true,
"has_credit_note": true,
"vat_is_recoverable": true,
"returned_at": "2023-11-07T05:31:56Z",
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z",
"items": "<array>"
}Confirm a purchase return
Confirms a draft return to the supplier: tracked goods are taken out of the chosen stock sources and, when a supplier credit note applies, the purchase balance is reduced. If a replacement is expected, the quantities are reopened for receiving.
curl --request POST \
--url https://api.exowpee.com/v1/catalog/purchase-returns/{purchaseReturn}/confirm \
--header 'Authorization: Bearer <token>'import requests
url = "https://api.exowpee.com/v1/catalog/purchase-returns/{purchaseReturn}/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-returns/{purchaseReturn}/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-returns/{purchaseReturn}/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-returns/{purchaseReturn}/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-returns/{purchaseReturn}/confirm")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.exowpee.com/v1/catalog/purchase-returns/{purchaseReturn}/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>",
"purchase_id": "<string>",
"purchase_reception_id": "<string>",
"vendor_id": "<string>",
"reference": "<string>",
"status": "<string>",
"vat_total": 123,
"replacement_expected": true,
"has_credit_note": true,
"vat_is_recoverable": true,
"returned_at": "2023-11-07T05:31:56Z",
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z",
"items": "<array>"
}purchase_returns.confirm
Conditions
- The supplier return must still be a draft; a return already confirmed is refused with a conflict (409).
- The return must have at least one item (409).
- The purchase must still be pending or completed.
- When the return is attached to a reception, that reception must belong to the same purchase and be confirmed.
- replacement_expected and has_credit_note cannot both be true.
- Every item is checked again at confirmation against the quantities received and accepted and not already returned by other returns, and against the stock actually held in the chosen sources; quantities, units and sources that no longer fit are refused.
- A VAT amount above zero requires a credit note.
- With a credit note, the VAT cannot exceed the value of the returned items, and the VAT of all confirmed credit-note returns of the purchase cannot exceed the VAT recorded on the purchase.
- With a credit note, the value of the returned items cannot exceed what remains of the supplier invoice after debt adjustments and earlier credit-note returns.
- Withdraws the returned quantity of each stock-tracked item from the stock sources (assets or groups) named on the item, as a purchase-return stock operation, and records on each item the inventory cost that left stock (stock_cost_total). Untracked items do not move stock.
- Recomputes the cost_total of each item from the first-in-first-out allocation of the received quantities.
- Sets the return status to confirmed and returned_at to the time of confirmation. A confirmed return can no longer be edited or deleted.
- When has_credit_note is true, the value of the returned items counts as returned against the purchase, which lowers its remaining amount (it can become a supplier credit); the purchase amount paid, remaining amount and payment status are recalculated. Without a credit note the amount owed is not reduced.
- When replacement_expected is true, the remaining quantity to receive of each purchase item grows by the returned quantity (in the purchase unit), and a completed purchase goes back to pending.
- No accounting entry is posted by this action.
Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Path Parameters
Identifier of the purchase return (27-character KSUID string).
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, purchase_id, purchase_reception_id, vendor_id, reference, status, vat_total, replacement_expected, has_credit_note, vat_is_recoverable, returned_at, 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.purchaseItem, items.stockableUnit.
Response
Resource (only with response=resource).
Identifier of the supplier return (27-character KSUID string).
Identifier of the purchase the goods are returned to.
Identifier of the reception the return is attached to; null when the return was created for the whole purchase.
Identifier of the supplier, copied from the purchase.
Free reference of the return, unique among the company's purchase returns.
Lifecycle status: draft while it can still be edited or deleted, confirmed once the goods have left stock.
VAT on the supplier credit note in major units (the minor-unit amount divided by 10 to the power currency_exponent). 0 when there is no credit note.
True when the supplier is expected to send replacement goods; confirming then reopens the returned quantities for receiving.
True when the supplier issues a credit note for the returned goods; confirming then reduces the amount owed on the purchase. Cannot be true together with replacement_expected.
Whether the VAT of the purchase is recoverable, read from the purchase at rendering time; false when the purchase never set it.
Date and time the return was confirmed (ISO 8601); null while it is a draft.
Date and time the record was created (ISO 8601, UTC).
Date and time the record was last changed (ISO 8601, UTC).
Lines of the return. Present only when requested with include=items.