#aaaa-stripe-refund

1 messages ยท Page 1 of 1 (latest)

wise trench
#

Hi there

silver torrent
#

hi

wise trench
#

Ah actually

#

You don't need to do that

#

You just retrieve the charge itself

silver torrent
#

after that I calculate the amount

wise trench
#

I'm sorry I don't really understand what you are saying/asking at this point.

#

Can you give me way more details?

#

Do you have any example objects I can look at?

silver torrent
#

yes

#

I will paste the screenshot

#

for that

#

can you check

wise trench
#

What are you trying to do with this?

#

Like let's back up

#

What exactly is your goal here?

#

You want to create a refund, but why? When? What is the situation exactly?

silver torrent
#

ok so as per situation
I have 1 year subscription plan
I want to refund the amount if a customer wants to cancel the subscription at some point

#

So I guess the amount which I got after calculation is fine but after calling refund .create I got error
StripeInvalidRequestError: Refund amount ($----) is greater than unrefunded amount on charge ($11.90)

wise trench
#

So you want to refund the full amount that was paid at the beginning of the year? Or you are looking to refund the prorated amount?

silver torrent
#

refund the prorated amount

wise trench
#

And how are you performing the Subscription cancelation?

#

Are you setting prorate: true?

silver torrent
#

I am cancelling it after refund

#

no I have not set prorate:true

#

for cancellation
const deletedSubscription = await stripe.subscriptions.del(
req.body.subscritpionId
);

wise trench
#

Gotcha. Calculating proration yourself is pretty tricky

#

You could just have us calculate it via the credit and then delete that credit after issuing the refund

#

That would be much easier imo

silver torrent
#

can you please elaborate

#

which credit?

wise trench
#

That invoice item will be the proration amount

#

I'd recommend testing out cancelling the Sub using prorate: true and see what that behavior looks like

silver torrent
#

Ok I will do that

#

Thanks for the help
really appreciated
Keep it up๐Ÿ‘