All threads / Do you store lots of Stripe customer/billing data in your database or do you call it dynamically from Stripe?

Ask A Question

Notifications

You’re not receiving notifications from this thread.

Do you store lots of Stripe customer/billing data in your database or do you call it dynamically from Stripe?

Daniel Weaver asked in Gems / Libraries
Just wondering if it's best to store locally, in my own database, all of the customer's Stripe data or is it better to call for this every time I want to display it?

There's a lot of data and it feels funky to store it all locally and try to keep it all in sync. But on the other hand, calling the Stripe API all the time feels wrong too.

I'm thinking about card brand, card last 4 digits, trial end date, coupon applied, coupon end date, next billing date, etc.
I personally store a local copy of all the information I care about. You can pretty easily sync this information and it's going to make your app a lot quicker not having to hit the API for every page view that needs that information. Stripe doesn't change their data structures very often so you should be fine syncing it. You can also use webhooks to keep it up-to-date.
Join the discussion

Want to stay up-to-date with Ruby on Rails?

Join 37,629+ developers who get early access to new tutorials, screencasts, articles, and more.

    We care about the protection of your data. Read our Privacy Policy.

    logo Created with Sketch.

    Ruby on Rails tutorials, guides, and screencasts for web developers learning Ruby, Rails, Javascript, Turbolinks, Stimulus.js, Vue.js, and more. Icons by Icons8

    © 2020 GoRails, LLC. All rights reserved.