List All Sales

get https://api.vendloop.com/sales

Returns a paginated list of sales sorted by date in descending order.

Header

Authorization
String
Set value to Bearer SECRET_KEY
customer_id
integer
Specify an ID for the customer whose sales you want to retrieve
product_id
integer
Specify an ID to retrieve sales for the selected product only
variant_id
integer
Specify an ID to retrieve sales for the selected product variant only
employee_id
integer
Specify an ID to retrieve sales made by the selected employee only
start_date
datetime
A timestamp from which to start listing sales. see date & time formats section
end_date
datetime
A timestamp from which to stop listing sales. see date & time formats section
limit
integer
Specify how many records you want to retrieve per page. If not specified we use a default value of 50.
curl -L 'https://api.vendloop.com/sales/' \
-H 'Authorization: Bearer SECRET_KEY'
<?php

$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => 'https://api.vendloop.com/sales',
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_CUSTOMREQUEST => 'GET',
  CURLOPT_HTTPHEADER => array(
    'Authorization: Bearer SECRET_KEY'
  ),
));

$response = curl_exec($curl);

curl_close($curl);
echo $response;
var myHeaders = new Headers();
myHeaders.append("Authorization", "Bearer SECRET_KEY");

var requestOptions = {
  method: 'GET',
  headers: myHeaders,
  redirect: 'follow'
};

fetch("https://api.vendloop.com/sales", requestOptions)
  .then(response => response.text())
  .then(result => console.log(result))
  .catch(error => console.log('error', error));
val client = OkHttpClient()
val request = Request.Builder()
  .url("https://api.vendloop.com/sales")
  .addHeader("Authorization", "Bearer SECRET_KEY")
  .build()
val response = client.newCall(request).execute()

Sample Response

{
  "status":true,
  "message":"Sale records found",
  "data":[
    {
      "id":"50",
      "date":"2023-07-18 15:51:43",
      "due_date":null,
      "business_id":"1",
      "store_id":"1",
      "customer_id":"2",
      "employee_id":"2",
      "reference_no":"SALE/POS/725185062173",
      "note":"",
      "order_tax":"62.0000",
      "paid":"1302.0000",
      "payment_status":"paid",
      "sale_status":"completed",
      "shipping":"0.0000",
      "staff_note":"",
      "sub_total":"1340.0000",
      "grand_total":"1302.0000",
      "total_discount":"100.0000",
      "total_tax":"62.0000",
      "updated_at":null,
      "updated_by":null,
      "device_id":null,
      "items":[
        {
          "item_discount":"0.0000",
          "item_id":"9",
          "item_name":"Shoes (Children /  Green)",
          "item_price":"80.0000",
          "item_tax":"0.0000",
          "item_type":"standard",
          "item_variant_id":"8",
          "item_variant_name":"Children /  Green",
          "quantity":"2.0000",
          "sku":"17468468",
          "tax":null,
          "tax_method":"addition",
          "unit_code":"carton",
          "unit_id":"9"
        },
        {
          "item_discount":"0.0000",
          "item_id":"9",
          "item_name":"Shoes (Children / Red)",
          "item_price":"90.0000",
          "item_tax":"0.0000",
          "item_type":"standard",
          "item_variant_id":"7",
          "item_variant_name":"Children / Red",
          "quantity":"2.0000",
          "sku":"17468468",
          "tax":null,
          "tax_method":"addition",
          "unit_code":"carton",
          "unit_id":"9"
        },
        {
          "item_discount":"0.0000",
          "item_id":"4",
          "item_name":"Bottle Water",
          "item_price":"100.0000",
          "item_tax":"0.0000",
          "item_type":"standard",
          "quantity":"10.0000",
          "sku":"16216661",
          "tax":null,
          "tax_method":"subtraction",
          "unit_code":"bottle",
          "unit_id":"3"
        }
      ],
      "payments":[
        {
          "id":"70",
          "date":"2023-07-18 15:51:43",
          "employee_id":"2",
          "reference_no":"VPAY/509652487123",
          "paid_by":"cash",
          "amount":"1302.0000"
        }
      ],
      "tax":{
        "id":"1",
        "name":"VAT @5%",
        "code":"vat5",
        "rate":"5.0000",
        "type":"percent"
      }
    }
  ],
  "metadata":{
    "limit":50,
    "start":1,
    "total":1
  }
}
{
    "status": false,
    "message": "Sale records not found"
}

Fetch a Single Sale

get https://api.vendloop.com/sales/{id}

Returns details of a sale with the given ID.

Header

Authorization
String
Set value to Bearer SECRET_KEY
id required
integer
Auto-generated unique ID
reference
string
Specify the reference number for this sale. this is ignored if the id parameter is used
customer_id
integer
Specify an ID for the customer whose sale you want to retrieve
product_id
integer
Specify an ID to retrieve sales for the selected product only
variant_id
integer
Specify an ID to retrieve sales for the selected product variant only
employee_id
integer
Specify an ID to retrieve sales made by the selected employee only
start_date
datetime
A timestamp from which to start listing sales. see date & time formats section
end_date
datetime
A timestamp from which to stop listing sales. see date & time formats section
curl -L 'https://api.vendloop.com/sales/{id}' \
-H 'Authorization: Bearer SECRET_KEY'
<?php

$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => 'https://api.vendloop.com/sales/{id}',
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_CUSTOMREQUEST => 'GET',
  CURLOPT_HTTPHEADER => array(
    'Authorization: Bearer SECRET_KEY'
  ),
));

$response = curl_exec($curl);

curl_close($curl);
echo $response;
var myHeaders = new Headers();
myHeaders.append("Authorization", "Bearer SECRET_KEY");

var requestOptions = {
  method: 'GET',
  headers: myHeaders,
  redirect: 'follow'
};

fetch("https://api.vendloop.com/sales/{id}", requestOptions)
  .then(response => response.text())
  .then(result => console.log(result))
  .catch(error => console.log('error', error));
val client = OkHttpClient()
val request = Request.Builder()
  .url("https://api.vendloop.com/sales/{id}")
  .addHeader("Authorization", "Bearer SECRET_KEY")
  .build()
val response = client.newCall(request).execute()

Sample Response

{
  "status":true,
  "message":"Sale record found",
  "data":{
    "id":"50",
    "date":"2023-07-18 15:51:43",
    "due_date":null,
    "business_id":"1",
    "store_id":"1",
    "customer_id":"2",
    "employee_id":"2",
    "reference_no":"SALE/POS/725185062173",
    "note":"",
    "order_tax":"62.0000",
    "paid":"1302.0000",
    "payment_status":"paid",
    "sale_status":"completed",
    "shipping":"0.0000",
    "staff_note":"",
    "sub_total":"1340.0000",
    "grand_total":"1302.0000",
    "total_discount":"100.0000",
    "total_tax":"62.0000",
    "updated_at":null,
    "updated_by":null,
    "device_id":null,
    "items":[
      {
        "item_discount":"0.0000",
        "item_id":"9",
        "item_name":"Shoes (Children /  Green)",
        "item_price":"80.0000",
        "item_tax":"0.0000",
        "item_type":"standard",
        "item_variant_id":"8",
        "item_variant_name":"Children /  Green",
        "quantity":"2.0000",
        "sku":"17468468",
        "tax":null,
        "tax_method":"addition",
        "unit_code":"carton",
        "unit_id":"9"
      },
      {
        "item_discount":"0.0000",
        "item_id":"9",
        "item_name":"Shoes (Children / Red)",
        "item_price":"90.0000",
        "item_tax":"0.0000",
        "item_type":"standard",
        "item_variant_id":"7",
        "item_variant_name":"Children / Red",
        "quantity":"2.0000",
        "sku":"17468468",
        "tax":null,
        "tax_method":"addition",
        "unit_code":"carton",
        "unit_id":"9"
      },
      {
        "item_discount":"0.0000",
        "item_id":"4",
        "item_name":"Bottle Water",
        "item_price":"100.0000",
        "item_tax":"0.0000",
        "item_type":"standard",
        "quantity":"10.0000",
        "sku":"16216661",
        "tax":null,
        "tax_method":"subtraction",
        "unit_code":"bottle",
        "unit_id":"3"
      }
    ],
    "payments":[
      {
        "id":"70",
        "date":"2023-07-18 15:51:43",
        "employee_id":"2",
        "reference_no":"VPAY/509652487123",
        "paid_by":"cash",
        "amount":"1302.0000"
      }
    ],
    "tax":{
      "id":"1",
      "name":"VAT @5%",
      "code":"vat5",
      "rate":"5.0000",
      "type":"percent"
    }
  }
}
{
    "status": false,
    "message": "Sale record not found"
}

Delete a Single Sale

post https://api.vendloop.com/sales/delete

Delete sale with the given ID.

Header

Authorization
String
Set value to Bearer SECRET_KEY
id required
integer
The ID of the sale to be deleted.
curl -L 'http://api.vendloop.com/sales/delete' \
-H 'Authorization: Bearer SECRET_KEY' \
-F 'id="{id}"'
<?php

$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => 'https://api.vendloop.com/sales/delete',
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_CUSTOMREQUEST => 'POST',
  CURLOPT_POSTFIELDS => array('id' => '{id}'),
  CURLOPT_HTTPHEADER => array(
    'Authorization: Bearer SECRET_KEY'
  ),
));

$response = curl_exec($curl);

curl_close($curl);
echo $response;
var myHeaders = new Headers();
myHeaders.append("Authorization", "Bearer SECRET_KEY");

var formdata = new FormData();
formdata.append("id", "{id}");

var requestOptions = {
  method: 'POST',
  headers: myHeaders,
  body: formdata,
  redirect: 'follow'
};

fetch("https://api.vendloop.com/sales/delete", requestOptions)
  .then(response => response.text())
  .then(result => console.log(result))
  .catch(error => console.log('error', error));
val client = OkHttpClient()
val mediaType = "text/plain".toMediaType()
val body = MultipartBody.Builder().setType(MultipartBody.FORM)
  .addFormDataPart("id","{id}")
  .build()
val request = Request.Builder()
  .url("https://api.vendloop.com/sales/delete")
  .post(body)
  .addHeader("Authorization", "Bearer SECRET_KEY")
  .build()
val response = client.newCall(request).execute()

Sample Response

{
  "status":true,
  "message":"Sale record deleted"
}
{
    "status": false,
    "message": "Sale record not found"
}