Stripe.js - issue refund on subscriptions; how to get PaymentIntent

I am creating a check-out for my subscription business using Stripe.js - and I am stuck on the final small detail.

How do I get PaymentIntent or Charge returned from the API?

The subscription is created using “Stripe.js - subscription - create”, which - in contrast to the “Stripe.js - Paymentintent - Create” doesn’t create a paymentintent. The latter can only be used for 1 time products as I can see.

And in order to use the “Stripe.js - Refund - Create”, the parameter of PaymentIntent or Charge is required.

Longer story
I have successfully set up the creation of a user, attach payment method and creating a subscription. The subscription charge is done every 4 weeks and the actual delivery is 4 boxes. I want to allow the user to cancel one or more boxes every month.

My idea is to do this by simply creating a refund for number of boxes cancelled in the month (better suggestions are welcome as well!).

However, to do this I need the paymentIntent Id or Charge for that month’s subscription. Where do I get that from?

In case someone else is looking for the same: I figured it out by building my own API. Happy to write more about the solution if anyone is in need of it.

Hello, if you could please share what API call you used to refund a subscription payment? thank you

Sorry, I’m first seeing this now. Do you still need it? :slight_smile:

@maja-overgaard I am in need of this API. Thanks in advance!