Their should be ability to manage the discount field through the invoice API or it should default value to the discount field as it behaves in NXT UI.
Once we have created new payment terms or edit existing to apply discount percentage and days both.
Apply this payment term to any of the vendor and create the invoice, if we are not updating the discount fields, it will take the discount expiration date according to the payment term assigned to that vendor.
Where as in an invoice created through the API, discount expiration date is set to null, it is not taking the default according to the payment terms applied to the vendor.
Even if ability to manage that is added in the API, this behavior should be same. If we have passed the date, it should utilize that date and if passed null it should apply the default one. Same behavior that we have in NXT UI.