VAT on Sales Invoice Via REST Seems not to work

I have indicated the sales tax template
“taxes_and_charges”:“FULL INVOICE - DBL”,

Any help especially a working example is highly appreciated, JSON below

{“title”:“OI-1641-171383 - ANTHONY Van C”,
“naming_series”:
“ACC-SINV-.YYYY.-”,
“customer”:“By Grace”,
“docstatus”:1,
“posting_date”:“2023-02-21”,
“posting_time”:“13:17:55.000000”,
“po_date”:“2023-02-2113:17:55”,
“set_posting_time”:true,
“due_date”:“2023-02-22T09:00:00”,
“currency”:“KES”,
“conversion_rate”:1,“company”:“D BID LIMITED”,
“is_return”:false,
“ignore_pricing_rule”:“1”,
“selling_price_list”:“Standard Selling”,
“price_list_currency”:“KES”,
“plc_conversion_rate”:1,
“update_stock”:true,
“base_total”:1106.52,
“total”:1106.52,
“base_net_total”:1106.52,
“net_total”:1106.52,
“base_discount_amount”:49.74,
“discount_amount”:49.74,
“taxes_and_charges”:“FULL INVOICE - DBL”,
“base_total_taxes_and_charges”:169.08,
“total_taxes_and_charges”:169.08,
“base_grand_total”:1225.86,
“grand_total”:1225.86,
“apply_discount_on”:“Net Total”,
“debit_to”:“Debtors - DBL”,
“party_account_currency”:“KES”,
“is_opening”:“No”,
“set_warehouse”:“DIBID LIMITED_wh - DBL”,
“items”:[
{“name”:“BBM Ori(250gx48)”,
“qty”:“6”,
“delivered_qty”:“6”,
“stock_qty”:“6”,
“item_code”:“21028401”,
“item_name”:“BBM Ori(250gx48)”,
“base_rate”:133.9336,
“rate”:133.9336,
“standard_rate”:133.9336,
“base_amount”:692.76,
“amount”:692.76,
“uom”:“grams”,
“description”:“BBM Ori(250gx48)”,
“conversion_factor”:1,
“discount_amount”:31.14,
“income_account”:“Sales - DBL”,
“expense_account”:“Cost of Goods Sold - DBL”,
“warehouse”:“DIBID LIMITED_wh - DBL”,
“net_rate”:133.9336,
“net_amount”:692.76,
“base_net_rate”:133.9336,
“base_net_amount”:692.76,
“cost_center”:“Main - DBL”,
“docstatus”:1,
“doctype”:“Sales Invoice Item”,
}]

}

I asked Chat GPT and got a simple answer which worked, I guess I was making things complicated myself.

Me: ERPNext create an invoice with VAT using rest api step by step, my customer name is Mama Kennedy, I want to include 10 pieces of an item called BBM Ori(30gx180) and the item tax template is Kenya Tax - DBL

Make sure Kenya Tax - DBL exist as an item tax template, you will need to change to appropriate account_head

I changed item code to reflect actual i.e. from BBM Ori(30gx180) to 67785881

ChatGPT:

{
“doctype”: “Sales Invoice”,
“company”: “XYZ LIMITED”,
“customer”: “Mama Kennedy”,
“items”: [
{
“item_code”: “67785881”,
“qty”: 10,
“rate”: 1000,
“tax_template”: “Kenya Tax - DBL”
}
],
“taxes”: [
{
“charge_type”: “Actual”,
“account_head”: “VAT - DBL”,
“description”: “Kenya VAT - DBL 16.0%”,
“tax_amount”: 1600,
“tax_rate”: 16.0
}
]
}

Thanks ChatGPT :wink: