When a subscription is upgraded, Stripe will automatically calculate the prorated amount that the customer owes. For example, if a customer is moved from a $10.00/mo subscription price to a $100.00/mo subscription price in the middle of their billing cycle, they are owed a $5.00 credit for the first price and they owe $50.00 for the new price. This means that they owe a total of $45.00 for the subscription upgrade. This amount can be charged at the end of the billing cycle or immediately by creating an invoice.
When a subscription is downgraded or canceled, the customer may be owed a credit. If a customer moves from a $100.00/mo subscription price to a $10.00/mo subscription price in the middle of the billing cycle, they are owed $50.00 for the first price and owe $5.00 for the new price. A total of $45.00 is now owed to the customer for the subscription downgrade and that credit ends up being added to their credit balance to be applied to future invoices.
Some merchants may want to refund that credit amount directly to their customers' original method of payment. Today, this is not something that happens automatically and instead can be actioned by the merchant.
subscription parameter to view Invoices for that Subscription ID only
Then, for each invoice: