How to refill a customers account credits every month if their subscription payment goes through with stripe

My website is a subscription based website that uses stripe as payment with the following plan.

$24.99/ Month
This subscription gives the customer 10 credit a month to use to purchase reports. Each report cost 1 credit.

Every month the credits are refilled to a total of 10 no matter how many are left over from the previous month.

The part im stuck on is how to automatically have the website refill the customers account with 10 credits after their monthly subscription renews and if their subscription does not renew then to clear their leftover credits from their account.

Additionally…
I am using the MERN Stack and was thinking of storing the credits in the userSchema. Would this be the correct way of assigning credits to users?

As of now I have a planSchema and a userSchema. Credits are stored in the userSchema and once the customer subscribes with stripe it applies these credits to their userProfile stored in mongodb.

What I would like to happen..
Example: Customer subscribes on November 1st and receives 10 credits. Customer uses 8 credits for the month of November. December 1st their subscription renews and their credits are then reset to 10.