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'd like to issue a refund, you can do so through Stripe's dashboard or via the API.
I created a monthly subscription, and I only want to refund the amount of money for the number of days that have not yet passed within the month of the subscription. How can I refund only the amount of money from the subscription for the days that are not complete yet with the Stripe API?
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