Is it possible to use Stripe for subscriptions with static website + per user storage?

23 Views Asked by At

I am making a static website that stores user data in user's cloud drive. I want to have a "premium" tier with more features. The question is: is it possible to create a Stripe customer and create/query their subscriptions to my product entirely on the client side in the browser based on some unique user ID I have (the user identifier of the cloud drive service)?

1

There are 1 best solutions below

0
alex On

No, creating a Stripe customer and creating/querying their subscriptions are all requests that need to be made using the secret key.

Having access to the secret API key allows someone to perform any API request without restriction so the secret key should only be stored/used on the server side for security reasons and should be kept safely : https://stripe.com/docs/keys#safe-keys

Your frontend should send the request to your backend server, and your backend server make the request instead, then return the relevant details to your frontend.