Stripe subscription integration

So I have two plans within my app - paid and free.
Assume a user is subscribed to a paid monthly subscription and paid $30 at the beginning of the term, he than mid-month decides to change to a free plan. So at this point I cancel the subscription, and I would like to refund the user the prorated amount ($15).
I understand that I can use the API connector to process the $15 refund, but in order to do this I need to capture the charge id somewhere --> when and how do I capture the charge id?
Or is there another easier way to do this - maybe I am over complicating things.

Hey @pawelodr are you using the Stripe Bubble plugin or Stripe.js?

If you’re using the Stripe.js config, you can simply retrieve the ChargeID from the Subscription - Confirm action, and store that in the User’s DB for example. You would need to have a webhook that sends the latest ChargeID to your app every time the subscription is renewed. This way you’ll always have the latest ChargeID, and will be able to make the refund on your end.

Hope that helps!
Ambroise

Need extra help?

Book a free 15 minutes call - happy to help if I can

Hi @ambroisedlg
Thanks very much for your reply, I was using Stripe bubble plugin, but earlier today, I have started looking into Stripe.js and I am in the process of watching the tutorial video from copilot guys:

Its going to be a little painful to change my subscription logic in my app to stripe.js, but I think it will be helpful in the long run.
Cheers,
Pawel