I don’t know of any documentation on Infusionsoft error codes, however, to update a custom field on the order table using dsUpdate you would do the same thing as you would with contacts. In your $orderDetails array add the custom field to the array in the same way as it is for contacts. So add an array element that looks something like “_customField”=>“field value”
There you go The invoice table is not writeable by the api and it isn’t the table to get/store custom fields on. You must use the order not the invoice. That is to say the “Job” table which is the order table (old name)