⚡Update Balance
This endpoint enables you to add payment to sale record based on a sale id.
Endpoint
PUT https://api.keepup.store/v2.0/sales/balance/{sale_id}
Headers
Authorization: Bearer API_KEY
Body Parameters
amount_paid
string
required
Amount paid for the sale.
alert_customer
string
optional
Whether to alert the customer (yes, no).
payment_type
string
optional
Method of payment.
date
string
optional
Date by which the sale should be settled (format: YYYY-MM-DD HH:MM).
Sample Requests
const axios = require('axios');
const data = JSON.stringify({
  "date": "2023-01-15 15:15",
  "payment_type": "Credit Card",
  "amount_paid": "200.00",
  "alert_customer": "yes",
});
const config = {
  method: 'post',
  url: 'https://api.keepup.store/v2.0/sales/balance/{sale_id}',
  headers: { 
    'Content-Type': 'application/json',
    'Authorization': 'Bearer {access_token}'
  },
  data : data
};
axios(config)
.then(function (response) {
  console.log(JSON.stringify(response.data));
})
.catch(function (error) {
  console.error(error);
});
$curl = curl_init();
$data = json_encode([
  "date" => "2023-01-15 15:15",
  "payment_type" => "Credit Card",
  "amount_paid" => "200.00",
  "alert_customer" => "yes",
]);
curl_setopt_array($curl, [
  CURLOPT_URL => "https://api.keepup.store/v2.0/sales/balance/{sale_id}",
  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/balance/{sale_id}"
payload = json.dumps({
  "date": "2023-01-15 15:15",
  "payment_type": "Credit Card",
  "amount_paid": "200.00",
  "alert_customer": "yes",
})
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": "balance updated",
    "data": {
        "balance_due": "0.00",
        "amount_paid": "110.00",
        "amount_received": "200.00",
        "change": "0.00",
        "status": "receipt",
        "payment_log": [
            {
                "updated_by": "API",
                "amount_received": "200.00",
                "amount_paid": "110.00",
                "balance_remaining": "0.00",
                "payment_type": "Credit Card",
                "created_at": "2023-05-02 15:15:00"
            }
        ],
        "outstanding_balance": {
            "meta": {
                "total_outstanding_balance_due": "0.00",
                "total_records": 0
            },
            "sales": []
        }
    }
}{
    "status": 401,
    "error": "Authentication invalid"
}Last updated
