Pro-rating a subscription change
If you are using Stripe for payments, pro-rating a subscription change is built in. The subscriber simply needs to select a higher or lower level plan and pay for it.
When a customer’s plan changes during a billing cycle, a proration line item is applied on their next invoice. Note: The proration occurs during the next billing cycle and only works on recurring subscriptions.
Here is the Stripe doc: https://stripe.com/docs/billing/subscriptions/prorations
How to Take Payment Immediately
If you do not want to prorate the subscription and would like to invoice for the difference immediately, you can add the following php snippet to your theme's functions.php file.