Keepup Store Docs
Home
  • Welcome
  • 💡Tutorials
    • Overview
    • Account Set Up
    • Sales
      • 💡How to Create a Quote, Invoice or Receipt
      • 💡How to Edit a Quote or an Invoice
      • 💡How to Record Payment for a Quote or an Invoice.
      • 💡How to Filter Sales
      • 💡How to Delete a Sale
      • 💡How to Print a Sale
    • Inventory
      • 💡How to Add a Product
      • 💡How to Edit a Product
      • 💡How to Filter Products
      • 💡How to Delete a Product
      • 💡How to Record Damaged or Lost Products
      • 💡How to Import Products
    • Orders
      • 💡How to Create an Order
      • 💡How to Update an Order
      • 💡How to Filter Orders
      • 💡How to Print Order Labels
      • 💡How to Delete an Order
    • Customers
      • 💡How to Add a Customer
      • 💡How to Import Customers
      • 💡How to Edit a Customer
      • 💡How to Filter Customers
      • 💡How to Delete Customers
      • 💡How to Message Customers
      • 💡How to View Customers Feedback
      • 💡How to Buy SMS/Email Bundle
    • Expenses
      • 💡How to Record an Expense
      • 💡How to Edit an Expense
      • 💡How to Record Payment for an Expense
      • 💡How to Filter Expenses
      • 💡How to Delete an Expense
      • 💡How to View Expenses Analytics
    • Subscription
      • 💡How to Renew Your Subscription
    • Storefront
      • 💡How to Set Up Your Storefront
      • 💡How to Publish and Unpublish Your Storefront
      • 💡How to Update Storefront Settings
      • 💡How to View Storefront Orders
      • 💡How to View Abandoned Carts
    • Purchase Order
      • 💡How to create a Purchase Order
      • 💡How to edit a Purchase Order
      • 💡How to filter Purchase Orders
      • 💡How to delete Purchase Orders
      • 💡How to update a Purchase Order status
      • 💡How to record payment for a Purchase Order
    • Business Settings
      • 💡How to Update Business Information
      • 💡How to Verify your Business
      • 💡How to Manage Your Business API
      • 💡How to Update Sale Settings
      • 💡How to Manage Your Tax Profiles
      • 💡How to Manage Your Delivery and Pick Up Locations
      • 💡How to Manage Your Online Payments Options
      • 💡How to Manage your Offline Payments Options
    • Raw Materials
      • 💡How to Add a Raw Material
      • 💡How to Edit a Raw Material
      • 💡How to Import Raw Materials
      • 💡How to Filter Raw Materials
      • 💡How to Delete a Raw Material
      • 💡How to Record Damaged or Lost Raw Materials
      • 💡How to Create a Manufacturing Order
      • 💡How to Edit a Manufacturing Order
      • 💡How to Filter Manufacturing Orders
      • 💡How to Update a Manufacturing Order Status
      • 💡How to Delete a Manufacturing Order
    • Team Members
      • 💡How to Add Team Members
      • 💡How to Update a Team Member's Permissions
      • 💡How to Filter Team Members
      • 💡How to Remove a Team Member
      • 💡How to View Team Members' Action Logs
    • Damages & Loss
      • 💡How to Filter Damages & Loss
      • 💡How to Edit a Damaged or Lost Item
      • 💡How to Delete a Damaged or Lost Item
    • How to Access Keepup Store Version 2.0
  • âš¡API
    • Introduction
    • Sales
      • âš¡List Sales
      • âš¡Fetch Sale
      • âš¡Add Sale
      • âš¡Edit Sale
      • âš¡Update Balance
      • âš¡Cancel Sale
      • âš¡Refund Sale
    • Products
      • âš¡List Products
      • âš¡Fetch Product
      • âš¡Add Product
      • âš¡Edit Product
Powered by GitBook
On this page
  • Endpoint
  • Headers
  • Body Parameters
  • Sample Requests
  • Sample Response
  1. API
  2. Sales

Edit Sale

This endpoint enables you to edit details of an existing sale that has not been finalized.

Endpoint

PUT https://api.keepup.store/v2.0/sales/edit/{sale_id}

Headers

Authorization: Bearer API_KEY

Body Parameters

sale_id

number

required

The sale ID of the sale to be edited. Example: 123

customer_name

date

optional

Customer's full name. Example: "Chinedu Okeke"

phone_number

string

optional

Customer's phone number. Example: "233201234567"

customer_email

string

optional

Customer's email address

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 delivery

location

string

optional

Detailed address for delivery

lat

string

optional

Latitude for the delivery location.

lng

string

optional

Longitude for the delivery location.

fulfillment_cost

string

optional

Cost associated with the fulfillment.

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

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: "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)

Sample Response

{
    "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"
}
PreviousAdd SaleNextUpdate Balance

Last updated 1 year ago

âš¡
âš¡