How to create a Sales Invoice using a API

I’m trying to create a sales invoice from an API but I am getting an error saying

“base_grand_total = base_grand_total - flt(self.base_write_off_amount)\nTypeError: unsupported operand type(s) for -: ‘NoneType’ and ‘float’\n"]”"

Below is my code and error

Hi @Nyasha_Karata
Please check the value of base_grand_total. It should not be None.