Create and return a purchase for the specified business id and branch id. Purchase can be for various items including appointments, products, courses and vouchers.
One thing to note is the rounding strategy employed when applying taxes and discounts. Tax and discounts are always rounded HALF UP up to the cent. This applies to all currencies. For example:
With VAT of 20% on $100 the tax is $16.6666... which is rounded to $16.67.
With a sales tax of 10.5% on $1 we get $0.105 which is rounded to $0.11. 10.4% would be rounded to $0.10.
For salons where the price of goods / services are inclusive of tax, you should provide the gross amount as price for each purchase item. For example:
A purchase item whose net price is €100 with tax at 20%, should have its gross price of €120 specified as the item price in the request.
For salons where the price of goods / services are exclusive of tax, you should provide the net amount as price for each purchase item. For example:
A purchase item whose net price is $100 with tax at 20%, should have its net price of $100 specified as the item price in the request. However, the total payment amount for the sale must be the gross amount. In this example, where a single item with a net price of $100 is purchased at a 20% tax rate, the total payment amount for the sale is $120.
Payment
If the request contains a larger payment amount than is needed to cover the total cost of items being purchased, we return the difference as change. Please note that overpayment is determined based on the tax rates currently assigned in Phorest to the items being purchased, and not on the tax rates specified in the API request.
If the request contains a smaller payment amount than is needed to cover the total cost of items being purchased, we reject the purchase and return an error. Please note that underpayment is determined based on the tax rates currently assigned in Phorest to the items being purchased, and not on the tax rates specified in the API request.
Credit Account Transaction
A purchase of for clients credit account transaction needs outstandingBalancePayment set to true. With this request you'll also need a staffId and price.
Voucher
System supports creating vouchers sales via purchase
operation. If purchase item contains voucher data, it will be treated as a voucher purchase item.
In that case, following rules will apply:
serial
If voucher's serial number is not provided, system will generate it
expiry date
Expiry date must be in future.
quantity
Number of vouchers to be created depends on thequantity
field.
Example: Forquantity=2
andprice=1.00
, System will generate 2 vouchers with balance 1.00.
tax-voucher
On the voucher sale, tax won't be calculated so the tax field is not required.