Jump to content

How to apply an overall discount to a Sales Invoice created via API


 Share

Recommended Posts

Hi All,

I'm currently trying to create a Sales Invoice that includes an overall discount but whatever I try doesn't seem to carry through to Sage.

The field that is suggested in the documentation is the 'total_discount_amount' which we pass over with no error but do not see listed anywhere on the invoice nor does it affect the totals.

If anyone could help or point me in the right direction to documentation that might give more information it would be greatly appreciated.

Thanks

Link to comment
Share on other sites

Hi Sirbastian, thank you for your question.

I'm presuming that you are trying to POST a sales_invoice to Sage Business Cloud Accounting when you say "SAGE"?

The total_discount_amount is the total of discounts belonging to each of the item lines of the invoice. For example an invoice with three item lines each with a discount of 10.00 would mean the total_discount_amount = 30.00. It's not possible to set an invoice level discount in SBCA and discounts must be applied on a line by line basis. 

The example below shows how a discount can be set for an item line and the attached image shows the result in the SBCA UI.


 

{
    "sales_invoice": {
        "contact_id": "7d5331e5a8204f35b8f0a801e85c834a",
        "date": "2021-09-15",
        "due_date": "2021-10-15",
        "invoice_lines": [
            {
                "description": "Test Item Line",
                "ledger_account_id": "2c8d7ef0b3bb11ebb35d02665419b6eb",
                "quantity": 1,
                "tax_amount": 1.80,
                "tax_rate_id": "GB_STANDARD",
                "unit_price": 10,
                "unit_price_includes_tax": false,
                "discount_amount": 1.00
            }  
        ]   
    }
}

 

Screenshot 2021-09-15 at 15.01.12.png

Link to comment
Share on other sites

  • 1 year later...

Hi Reginald,

Thank you for your question.

At present setting the discount_percentage on a POST request to sales_invoices does not invoke the internal method to calculate the discount_amount as you see in the web UI.

You would also need to set the discount_amount should you wish the discount_percentage to be persisted.

 

{
	"sales_invoice": {
		"contact_id": "2e01687362494a2697a51301a8697ea1",
		"date": "2023-07-07",
	    "total_discount_amount":"10",
		"invoice_lines": [{
			"description": "Test discount",
			"ledger_account_id": "fba3a5ec7a1311ed91ce06907ea83981",
			"unit_price": "100",
            "tax_amount": "18.00",
            "tax_rate_id":"GB_STANDARD",
			"quantity": "1",
            "unit_price_includes_tax":false,
	        "discount_percentage":"10.00",
            "discount_amount":"10.00"
		}]
      
	}
}

Thanks

Mark

Link to comment
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
 Share

×
×
  • Create New...