⚡Edit Sale
This endpoint enables you to edit details of an existing sale that has not been finalized.
Endpoint
Headers
Body Parameters
Sample Requests
Sample Response
Last updated
This endpoint enables you to edit details of an existing sale that has not been finalized.
Last updated
const axios = require('axios');
const data = {
customer_name: "Chinedu Okeke",
phone_number: "+233801234567",
customer_email: "[email protected]",
items: JSON.stringify([
{
item_id: 11,
item_name: "Bananas",
quantity: 10,
price: 20,
item_type: "product"
},
...
]),
fulfillment_type: "delivery",
location_name: "Awesome Place",
location: "1234 Awesome Place Ave, Ghana",
lat: "40.7128",
lng: "-74.0060",
fulfillment_cost: "10.00",
discount_type: "fixed",
discount_amount: "10.00",
note: "Urgent delivery",
issue_date: "2023-01-01 15:15",
due_date: "2023-01-15 15:15",
payment_type: "mobile_money",
amount_received: "200.00",
alert_customer: "yes"
});
const sale_id = 'YOUR_SALE_ID'; // Replace 'YOUR_SALE_ID' with your actual sale ID
const config = {
method: 'put',
url: `https://api.keepup.store/v2.0/sales/edit/${sale_id}`,
headers: {
'Content-Type': 'application/json',
'Authorization': 'Bearer API_KEY'
},
data: data
};
axios(config)
.then(function (response) {
console.log(response.data);
})
.catch(function (error) {
console.error(error);
});
<?php
$curl = curl_init();
$data = [
"customer_name" => "Chinedu Okeke",
"phone_number" => "+233801234567",
"customer_email" => "[email protected]",
"items" => json_encode([
[
"item_id" => 11,
"item_name" => "Bananas",
"quantity" => 10,
"price" => 20,
"item_type" => "product"
]
// Add more items as needed...
]),
"fulfillment_type" => "delivery",
"location_name" => "Awesome Place",
"location" => "1234 Awesome Place Ave, Ghana",
"lat" => "40.7128",
"lng" => "-74.0060",
"fulfillment_cost" => "10.00",
"discount_type" => "fixed",
"discount_amount" => "10.00",
"note" => "Urgent delivery",
"issue_date" => "2023-01-01 15:15",
"due_date" => "2023-01-15 15:15",
"payment_type" => "mobile_money",
"amount_received" => "200.00",
"alert_customer" => "yes"
];
$sale_id = 'YOUR_SALE_ID'; // Replace 'YOUR_SALE_ID' with your actual sale ID
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.keepup.store/v2.0/sales/edit/$sale_id",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_POSTFIELDS => json_encode($data),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"Authorization: Bearer API_KEY"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
?>
import requests
import json
data = {
"customer_name": "Chinedu Okeke",
"phone_number": "+233801234567",
"customer_email": "[email protected]",
"items": json.dumps([
{
"item_id": 11,
"item_name": "Bananas",
"quantity": 10,
"price": 20,
"item_type": "product"
}
# Add more items as needed...
]),
"fulfillment_type": "delivery",
"location_name": "Awesome Place",
"location": "1234 Awesome Place Ave, Ghana",
"lat": "40.7128",
"lng": "-74.0060",
"fulfillment_cost": "10.00",
"discount_type": "fixed",
"discount_amount": "10.00",
"note": "Urgent delivery",
"issue_date": "2023-01-01 15:15",
"due_date": "2023-01-15 15:15",
"payment_type": "mobile_money",
"amount_received": "200.00",
"alert_customer": "yes"
}
sale_id = 'YOUR_SALE_ID' # Replace 'YOUR_SALE_ID' with your actual sale ID
url = f"https://api.keepup.store/v2.0/sales/edit/{sale_id}"
headers = {
"Content-Type": "application/json",
"Authorization": "Bearer API_KEY"
}
response = requests.put(url, headers=headers, data=json.dumps(data))
try:
response.raise_for_status()
print(response.json())
except requests.exceptions.HTTPError as err:
print(err)
{
"status": 200,
"message": "sale updated",
"data": {
"sale_id": 48001,
"share_link": "https://keepup.store/v/01524188-65CJAY",
"balance_due": "0.00",
"amount_paid": "40.48",
"amount_received": "200.00",
"change": "159.52",
"status": "receipt",
"outstanding_balance": {
"meta": {
"total_outstanding_balance_due": "0.00",
"total_records": 0
},
"sales": []
}
}
}{
"status": 401,
"error": "Authentication invalid"
}