Hello Philippe,
We don't have a solution that will automatically refund the customer when an update to their subscription leads to a credit. Our product will automatically add the balance to the customer balance so that it's used on future invoices instead. This is the most common approach for businesses with recurring business.
The reason we don't have this as an option is that we don't support sending funds back to a payment method without this being tied to a previous payment. You can't charge someone $20 five times and then just send them back $100. Instead, you have to refund each charge so that the refund itself is tied to the original payment. It also ensures that the cardholder can't dispute those payments with their bank since they have been explicitly refunded.
With that in mind, it's possible for a subscription to have been upgraded a few times over the past month where the customer was charged in small increments. When they decide to cancel the most expensive price for example it's possible that you owe them a larger credit than what you most recently charged them. The recommended approach in that case is to build some logic that will look at how much credit they got after the downgrade and then refund the most recent payment that customer had for that amount. If that payment is lower than the credit amount, you then move to the next payment, until you've exhausted the whole credit amount. Once you're done, you can reset their customer balance to remove the credit.
It's definitely complex to build properly, but it'd be as complex to abstract this on our end as every business will handle refunds in a different manner. It's something we've discussed in the past that we might offer in the future though but we haven't started working on this.
I hope this puts you on the right track, though you might be better off with defaulting to the credit for future invoices instead and handle the edge-case of customers requiring a refund by hand in the Dashboard for example.
Best,
Remi