Create Sale

Creates Invoice with Line Items and Payments

image-png-Mar-22-2024-01-25-37-4158-PM /invoices/create

https://api.oauth.pabau.com/{api_key}/invoices/create

Request

Query Parameters:  
api_key *  
contact_id * Int - System ID of the client
employee_id *  Int - System ID of the user/biller
appointment_id System ID of the appointment
location_id System ID of the location
invoice_date String - Date in format ("YYYY-MM-DD H:i:s")
* if not sent, will default to current date
sale_items 

json - [
{
   "id":{Int (System Id of the item)},*
   "quantity":{Int}},*
   "tax_id": {Int},
   "discount_id":{Int},

   "employee_id":{Int},

   "item_type":{String (product, service, package, account, gift_voucher)} *
},
{
    "id":{Int (System Id of the item)},*
   "quantity":{Int}},*
   "tax_id": {Int},
   "discount_id":{Int},

   "employee_id": {Int},

   "item_type":{String (product, service, package, account, gift-voucher)} *
}
]

payments json - [
{"method":{string},"amount":{Int}},
{"method":{string},"amount":{Int}}
]

 

Note: You can send user_id or biller_id in the employee_id field

If item_type = gift-voucher, the sale_item should look like this:
[{
   "item_type":"giftvoucher",
   "price":{Float},
   "valid_from": {String (date(Y-m-d))},
   "valid_to": String (date(Y-m-d))},
   "template_id": {Int},
}]

If item_type = account, there should be only one sale_item like this:
[{

   "price": {Float},
   "item_type":"account" 
}]

Response sample

application/json

{
"token": "{token}",
  "expiration": "2024-05-03T06:26:51.092Z",
"tenant": "{tenant}",
  "catalog": {
    
  },
  "success": true,
  "message": "Invoice Created",
"invoice_No": {Invoice Number},
"next_appointment": {ID}
}