#BastianInuk-pk

1 messages ยท Page 1 of 1 (latest)

dry cipher
#

๐Ÿ‘‹ happy to help

versed stag
#

Hi tarzan

dry cipher
#

just to make sure I follow, what you're trying to achieve here is basically getting you pk from your API?

versed stag
#

Essentially

dry cipher
#

any particular reason why you need to do that?

versed stag
#

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

dry cipher
#

are you doing the same for the server side/backend?

versed stag
#

Not yet

dry cipher
#

keys work in pair (secret and publishable)

versed stag
#

I'm aware

#

We're testing out new PaymentElement stuff, and I currently have a mock server for that

dry cipher
#

ok just making sure that this won't be oversighted

versed stag
#

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

dry cipher
#

it's a dev/infra choice

versed stag
#

So at worst it's not bad practice

dry cipher
#

I would just do one change in your code and I'll explain why

versed stag
#

Oh? ๐Ÿ‘€

#

I have thought of using env vars btw

dry cipher
#
  .then(r => r.json())
  .then(data => loadStripe(data.publishable))
versed stag
#

I don't see the difference? Is this just to give context?

dry cipher
#

the extra ) at the second line is to avoid the callback hell

#

it's nothing really important

versed stag
#

Ohhh

dry cipher
#

just being a linter ๐Ÿ™ˆ

versed stag
#

It's a typo from my end ๐Ÿ˜…

dry cipher
#

but the thing is, it will actually work

#

even with the typo

versed stag
#

Curse you Promise.prototype.then and your ability to take both a PromiseLike and a value the same

#

Anyways, thanks for your help!

dry cipher
#

no worries

#

let me know if you need any more help

versed stag
#

can you write my SetupIntend mock server?

#

Jk jk