freewebwithme
How can I use different stripe secret key for each user?
Hi guys!
I am using stripity_stripe for accept a payment in my backend server.
But I don’t want to set a api_key in config.exs. I want to use each user’s stripe secret key for their account.
Is there anyway to make a request to stripe api using each user’s secret key?
Marked As Solved
freewebwithme
I found a solution.
I can pass Stripe.Options for any request. Something like this.
Stripe.Customer(%{email: "john@example.com"}, api_key: user.stripe_secret_key)
Also Liked
albydarned
I think the way the library works sets the API key at compile time… I don’t know of a good way to do what you’re asking without forking and modifying the code. Someone on here more knowledgeable than me may chime in.
Perhaps you could consider making manual API calls?
As a side note, using a library like cloak to encrypt your keys is a good idea. I’ve used it before and it was quite easy to set up and use.
Popular in Discussions
Other popular topics
Categories:
Sub Categories:
Forums
Popular Tags
- #ecto
- #liveview
- #troubleshooting
- #learning-elixir
- #deployment
- #library
- #erlang
- #testing
- #genserver
- #mix
- #absinthe
- #remote-other
- #otp
- #plug
- #how-to-question
- #macros
- #postgres
- #channels
- #elixirconf
- #exunit
- #discussion
- #code-sync
- #javascript
- #podcasts
- #onsite
- #dialyzer
- #docker
- #authentication
- #umbrella
- #full-time-contract
- #podcasts-by-brainlid
- #ecto-query
- #elixir-ls
- #phoenix_html
- #iex
- #blog-post
- #graphql
- #genstage
- #ai
- #websockets
- #supervisor
- #advent-of-code
- #elixirconf-us
- #distillery
- #processes
- #forms
- #api
- #metaprogramming
- #security
- #performance









