#moki - Product Info Display
1 messages · Page 1 of 1 (latest)
Hello! We don't have a best practice for this; different situations call for different approaches.
Can you tell me more about your specific concerns?
If I hit the stripe API to retrieve relatively static product info every time a customer visits my site, could it slow down my site relying on the stripe API, for example, with a rate limit or something?
If for example there is a sudden flux of users checking out the site and possibly wanting to make a purchase, could I run into issues?
Yes, it would probably slow things down. I doubt you'd hit rate limits (our rate limits are generous), but it's not a good idea to fetch from the Stripe API every time a web page showing your products is loaded, for example.
What you can do is set up a webhook endpoint to listen for product.updated and price.updated events and update your local database with changes based on those events. That should keep your database in sync with Stripe.
I thought about doing that. I like this idea but not quite sure how to set this up for development and production if they use the same database. Any thoughts? I'd need to probably store product info in the db next to the stripe publishable key or something, right?
Well, development and production should not use the same database as a general best practice. 🙂 Setting that aside, though, all objects in Stripe have a livemode property that's set to either true or false to indicate live vs. test mode. You could use the same approach in your database.
ahhh, okay the live mode variable should solve my problem. Thanks for your quick reply and very helpful ideas