From the Stripe docs:
When you cancel the subscription, the customer\'s card will not be charged again, but no money will be refunded either. If you
You will need to calculate refund amount, and then make a refund API call to Stripe. After refund you will have to make another API call for Subscription cancellation