curl --request POST \
--url https://api.exowpee.com/v1/catalog/purchases/{purchase}/debt-adjustments \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"amount": 123,
"reason": "<string>",
"adjusted_at": "<string>",
"adjustment_date": "<string>"
}
'import requests
url = "https://api.exowpee.com/v1/catalog/purchases/{purchase}/debt-adjustments"
payload = {
"amount": 123,
"reason": "<string>",
"adjusted_at": "<string>",
"adjustment_date": "<string>"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
amount: 123,
reason: '<string>',
adjusted_at: '<string>',
adjustment_date: '<string>'
})
};
fetch('https://api.exowpee.com/v1/catalog/purchases/{purchase}/debt-adjustments', 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/purchases/{purchase}/debt-adjustments",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'amount' => 123,
'reason' => '<string>',
'adjusted_at' => '<string>',
'adjustment_date' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.exowpee.com/v1/catalog/purchases/{purchase}/debt-adjustments"
payload := strings.NewReader("{\n \"amount\": 123,\n \"reason\": \"<string>\",\n \"adjusted_at\": \"<string>\",\n \"adjustment_date\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
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/purchases/{purchase}/debt-adjustments")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"amount\": 123,\n \"reason\": \"<string>\",\n \"adjusted_at\": \"<string>\",\n \"adjustment_date\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.exowpee.com/v1/catalog/purchases/{purchase}/debt-adjustments")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"amount\": 123,\n \"reason\": \"<string>\",\n \"adjusted_at\": \"<string>\",\n \"adjustment_date\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"id": "<string>",
"purchase_id": "<string>",
"vendor_id": "<string>",
"amount": 123,
"reason": "<string>",
"adjusted_at": "2023-11-07T05:31:56Z",
"created_by_user_id": "<string>",
"purchase": {},
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z"
}{
"message": "<string>",
"errors": {}
}Adjust supplier debt
Reduces the amount owed on a credit purchase with a stated reason, for example a negotiated discount.
curl --request POST \
--url https://api.exowpee.com/v1/catalog/purchases/{purchase}/debt-adjustments \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"amount": 123,
"reason": "<string>",
"adjusted_at": "<string>",
"adjustment_date": "<string>"
}
'import requests
url = "https://api.exowpee.com/v1/catalog/purchases/{purchase}/debt-adjustments"
payload = {
"amount": 123,
"reason": "<string>",
"adjusted_at": "<string>",
"adjustment_date": "<string>"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
amount: 123,
reason: '<string>',
adjusted_at: '<string>',
adjustment_date: '<string>'
})
};
fetch('https://api.exowpee.com/v1/catalog/purchases/{purchase}/debt-adjustments', 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/purchases/{purchase}/debt-adjustments",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'amount' => 123,
'reason' => '<string>',
'adjusted_at' => '<string>',
'adjustment_date' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.exowpee.com/v1/catalog/purchases/{purchase}/debt-adjustments"
payload := strings.NewReader("{\n \"amount\": 123,\n \"reason\": \"<string>\",\n \"adjusted_at\": \"<string>\",\n \"adjustment_date\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
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/purchases/{purchase}/debt-adjustments")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"amount\": 123,\n \"reason\": \"<string>\",\n \"adjusted_at\": \"<string>\",\n \"adjustment_date\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.exowpee.com/v1/catalog/purchases/{purchase}/debt-adjustments")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"amount\": 123,\n \"reason\": \"<string>\",\n \"adjusted_at\": \"<string>\",\n \"adjustment_date\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"id": "<string>",
"purchase_id": "<string>",
"vendor_id": "<string>",
"amount": 123,
"reason": "<string>",
"adjusted_at": "2023-11-07T05:31:56Z",
"created_by_user_id": "<string>",
"purchase": {},
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z"
}{
"message": "<string>",
"errors": {}
}purchase_debt_adjustments.create
Conditions
- The purchase must be a credit purchase whose status is pending, completed or closed.
- The purchase must have a recognized supplier invoice (invoiced_at and invoice_total set).
- The remaining amount of the purchase, recalculated first, must be above zero.
- amount must be above zero and cannot exceed the remaining amount of the purchase, nor the supplier invoice total minus what was already adjusted.
- amount cannot have more decimals than the currency exponent.
- adjusted_at and adjustment_date are refused: the date is set by the server.
- Records the adjustment with the current time and the signed-in member.
- Adds the amount to the purchase’s amount_debt_adjusted and recalculates its amount paid, remaining amount and payment status; the amount owed to the supplier goes down.
- 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 (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, purchase_id, vendor_id, amount, reason, adjusted_at, created_by_user_id, 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: purchase, purchase.items, purchase.debtAdjustments, purchase.returns, purchase.pickups, purchase.deliveries, purchase.vendor.
Body
Amount to take off the debt, in major units, above zero, with at most as many decimals as the currency exponent. It cannot exceed the remaining amount of the purchase nor the part of the supplier invoice not yet adjusted.
Why the debt is reduced, for example a negotiated discount. Up to 255 characters.
255Not accepted: the adjustment date is set by the server to the time of the call.
Not accepted: the adjustment date is set by the server to the time of the call.
Response
Resource (only with response=resource).
Identifier of the debt adjustment (27-character KSUID string).
Identifier of the purchase whose debt was reduced.
Identifier of the supplier of the purchase, copied from it when the adjustment was created.
Amount by which the debt was reduced in major units (the minor-unit amount divided by 10 to the power currency_exponent).
Reason given for the reduction, for example a negotiated discount.
Date and time the adjustment was recorded (ISO 8601). Set by the server.
Identifier of the member who recorded the adjustment; null when no signed-in member was known.
The adjusted purchase. Present only when requested with include=purchase.
Date and time the record was created (ISO 8601, UTC).
Date and time the record was last changed (ISO 8601, UTC).