⚡Add Sale
This endpoint allows you to add a new sale record.
Endpoint
POST https://api.keepup.store/v2.0/sales/add
Headers
Authorization: Bearer API_KEY
Body Parameters
customer_name
date
optional
Customer's full name. Example: "Kojo Owusu"
phone_number
string
optional
Customer's phone number. Example: "233201234567"
items
json
required
List of items being sold in JSON format. Example: [{ "item_id": "123", "quantity": 2, "price": 70.00 }]
fulfillment_type
string
optional
Type of fulfillment (e.g., pick_up, delivery).
location_name
string
optional
Location name for the sale. Example: "Main Street Store"
location
string
optional
Detailed address for delivery. Example: "123 Main St, Anytown"
lat
string
optional
Latitude for delivery location. Example: 34.0522
lng
string
optional
Longitude for delivery location. Example: -118.2437
fulfillment_cost
string
optional
Cost associated with the fulfillment method. Example: 25.00
discount_type
string
optional
Type of discount (fixed or percentage).
discount_amount
string
optional
Amount of discount given. Example: 10.00
tax_profile
string
optional
Tax profile ID applicable to the sale. Example: "123"
note
string
optional
Any additional notes about the sale.
issue_date
string
optional
Date the sale was issued (format: YYYY-MM-DD HH:mm:ss).
due_date
string
optional
Date by which the sale should be settled (format: YYYY-MM-DD HH:mm:ss).
payment_type
string
optional
Type of payment received. Example: "mobile_money"
amount_received
string
optional
Amount received for the sale.
alert_customer
string
optional
Whether to alert the customer (yes, no).
sale_type
string
optional
Type of sale document (quote or invoice).
Sample Requests
const axios = require('axios');
const data = {
customer_name: "Efia Konadu",
phone_number: "+233201234567",
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 config = {
method: 'post',
url: 'https://api.keepup.store/v2.0/sales/add',
headers: {
'Content-Type': 'application/json',
'Authorization': 'Bearer {access_token}'
},
data: data
};
axios(config)
.then(function (response) {
console.log(response.data);
})
.catch(function (error) {
console.error(error);
});
$curl = curl_init();
$data = json_encode([
"customer_name" => "John Doe",
"phone_number" => "+1234567890",
"customer_email" => "[email protected]",
"items" => json_encode([["item_name" => "Widget A", "quantity" => 2, "price" => 19.99, "item_type" => "product"]]),
"fulfillment_type" => "delivery",
"location_name" => "Main Warehouse",
"location" => "1234 Warehouse Ave, City",
"lat" => "40.7128",
"lng" => "-74.0060",
"fulfillment_cost" => "5.00",
"discount_type" => "percentage",
"discount_amount" => "10",
"note" => "Urgent delivery",
"issue_date" => "2023-01-01 15:15",
"due_date" => "2023-01-15 15:15",
"payment_type" => "Credit Card",
"amount_received" => "200.00",
"alert_customer" => "yes",
"sale_type" => "invoice"
]);
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.keepup.store/v2.0/sales/add",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => $data,
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"Authorization: Bearer {access_token}"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
import requests
import json
url = "https://api.keepup.store/v2.0/sales/add"
payload = json.dumps({
"customer_name": "John Doe",
"phone_number": "+1234567890",
"customer_email": "[email protected]",
"items": "[{\"item_name\":\"Widget A\", \"quantity\":2, \"price\":19.99, \"item_type\":\"product\"}]",
"fulfillment_type": "delivery",
"location_name": "Main Warehouse",
"location": "1234 Warehouse Ave, City",
"lat": "40.7128",
"lng": "-74.0060",
"fulfillment_cost": "5.00",
"discount_type": "percentage",
"discount_amount": "10",
"note": "Urgent delivery",
"issue_date": "2023-01-01 15:15",
"due_date": "2023-01-15 15:15",
"payment_type": "Credit Card",
"amount_received": "200.00",
"alert_customer": "yes",
"sale_type": "invoice"
})
headers = {
'Content-Type': 'application/json',
'Authorization': 'Bearer {access_token}'
}
response = requests.request("POST", url, headers=headers, data=payload)
print(response.text)
Sample Response
{
"status": 200,
"message": "sale recorded",
"data": {
"sale_id": 48001,
"share_link": "https://keepup.store/v/01524BB-65CJAY",
"balance_due": "0.00",
"amount_paid": "200.00",
"amount_received": "200.00",
"change": "0.00",
"status": "receipt",
"outstanding_balance": {
"meta": {
"total_outstanding_balance_due": "0.00",
"total_records": 0
},
"sales": []
}
}
}{
"status": 401,
"error": "Authentication invalid"
}Last updated