Hi Max,
There is a GetDueDate method of the SBObob object in the DI API but unfortunately this only takes the BP Code and the document date as parameters so you can't use it when the PaymentGroupCode is different to the default code on the BP. I'm assuming that you are changing to a different code.
I suppose you could set up a special BP for each payment code (make them inactive and give them a special BP code that keeps them separate from the normal BP master data) and then you could use the GetDueDate method to calculate the due date, regardless of which code you are swapping to. It's a bit messy though, particularly if you have a lot of payment terms. Hopefully someone else has a better solution.
Kind Regards,
Owen