Create item adjustment - Fabric
Create item adjustment
cURL
curl --request POST \
--url https://api.fabric.inc/v3/carts/{cartId}/items/{itemId}/adjustments \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--header 'x-fabric-tenant-id: <x-fabric-tenant-id>' \
--data '
{
"price": {
"amount": 12.99
},
"reason": "Price adjustment from Customer Representative",
"attributes": {
"source": "CSR"
}
}
'```
### Python Example
import requests
url = "https://api.fabric.inc/v3/carts/{cartId}/items/{itemId}/adjustments"
payload = {
"price": { "amount": 12.99 },
"reason": "Price adjustment from Customer Representative",
"attributes": { "source": "CSR" }
}
headers = {
"x-fabric-tenant-id": "
response = requests.post(url, json=payload, headers=headers)
print(response.text)
### JavaScript Example
const options = {
method: 'POST',
headers: {
'x-fabric-tenant-id': '
fetch('https://api.fabric.inc/v3/carts/{cartId}/items/{itemId}/adjustments', options) .then(res => res.json()) .then(res => console.log(res)) .catch(err => console.error(err));
### PHP Example
"https://api.fabric.inc/v3/carts/{cartId}/items/{itemId}/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([
'price' => [
'amount' => 12.99
],
'reason' => 'Price adjustment from Customer Representative',
'attributes' => [
'source' => 'CSR'
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer