logoalt Hacker News

tonyxyesterday at 6:22 PM1 replyview on HN

This is really cool. How do you handle changes of pricing with something like this?


Replies

prasoondsyesterday at 6:42 PM

Great question. Basically, you would change your billing.config.ts and update the price.

Then, you run the `sync` command - it matches prices by a composite key: `productId:amount:currency:interval`. Since the amount has changed, it won't find a match for the old price. So, it will create a new price in Stripe and update the Price ID. Your new customers automatically get the new price in the Pricing Table component.

Your old subscriptions stay on the old price - which is still active in Stripe. We haven't added support for migrating these customers to the new price yet but it's in the roadmap!

I would like to add that we've tried making the porcelain / user API for the library to best fit today's commonly uses SaaS pricing models so most actions usually do what you would expect (like this price update) but, it's hard to strike a balance between customizability and the _just works_ factor.