ThriveCart does this: when a purchase is set up as an upgrade or downgrade, the old billing plan is cancelled and prorated, and the new billing plan begins with the proration applied. This would probably requiring payments to be separated from products, ideally using “offers,” which I will submit as a separate request.