vercel / nextjs-subscription-payments

Clone, deploy, and fully customize a SaaS subscription application with Next.js.
https://subscription-payments.vercel.app/
MIT License
6.08k stars 1.23k forks source link

Setting up a refund flow in manageSubscriptionStatusChange #180

Closed btahir closed 1 year ago

btahir commented 1 year ago

So Stripe for some reason does not give us a simple toggle to refund a customer if they cancel a Subscription through the Customer Portal and we have to do it manually.

I was thinking maybe we can add a flow to the Webhook on the Subscription Cancellation event and automatically issue a refund of the outstanding balance to the customer?

The Stripe Refund API call could be called in one of the cases in the manageSubscriptionStatusChange function?

Does this approach make sense?

Thanks!

thorwebdev commented 1 year ago

Yah, Stripe doesn't support this out of the box I'm afraid, looks to be quite involved: https://stackoverflow.com/questions/24790776/stripe-api-refund-after-subscription-cancelled

Do note that you might want to add some guard rails for folks signing up and cancelling immediately for a full refund as this can cause you to incur payment processing costs that Stripe nowadays doesn't refund anymore.

Hope this helps.