#BastianInuk-pk
1 messages ยท Page 1 of 1 (latest)
Hi tarzan
just to make sure I follow, what you're trying to achieve here is basically getting you pk from your API?
Essentially
any particular reason why you need to do that?
The main was is to make it easier to have testing keys for testers and production keys for costumers
Currently what we do is we have an object
const stripe = {
prod: loadStripe(production Key)
test: loadStripe(testing key)
}
So instead of doing that, I'd just have the keys on a server
are you doing the same for the server side/backend?
Not yet
keys work in pair (secret and publishable)
I'm aware
We're testing out new PaymentElement stuff, and I currently have a mock server for that
ok just making sure that this won't be oversighted
That's fair
So the idea is, I don't want to accidentally push the test key, and break purchase flow for everyone
So having the key pair, per user, on the server would be a nice dev QoL improvements
it's a dev/infra choice
So at worst it's not bad practice
I would just do one change in your code and I'll explain why
.then(r => r.json())
.then(data => loadStripe(data.publishable))
I don't see the difference? Is this just to give context?
the extra ) at the second line is to avoid the callback hell
it's nothing really important
Ohhh
just being a linter ๐
It's a typo from my end ๐