#johnpitchko-token

1 messages · Page 1 of 1 (latest)

frail quartz
#

Do you have any more details on the error other than undefined?

pastel cave
#

Unfortunately no. It seems that the Stripe JS is loading correctly.

frail quartz
#

How are you loading STripe.js?

pastel cave
#

Script tag in my application layout HTML file

frail quartz
#

Are you possibly loading v1 instead of v3?

pastel cave
#

Ah

#

Ok pointed to v3 but got a new error this time

frail quartz
pastel cave
#

Oh

#

No reason other than to confirm that the code is working in the app

#

Ok when I run in the app now, seems to be working. I get another error but the stripe variable seems to initialize now. Thanks!

#

Thanks for the unrelated help!

#

I don't do much front end

frail quartz
#

no problem!

pastel cave
#

Oh unrelated question. Can you use Stripe tokens for adding a credit card to a customer?

#

I've inherited a really old app that used Stripe tokens on the client side to capture a user's credit card. The token value would then be passed to the app server which created/updated the customer's credit card.

frail quartz
#

Yup! Tokens are one-time use, so you'd trade it in for a card/source and attach that to the customer. Of course, the recommendation nowadays is to use Payment Methods, but if you're working with an older app it's not surprising it's using legacy things

mellow turret
#

karbi Sorry to bother again ( cannot post in our other thread) but I'm struggling to find the docs on how to generate a client-side card token.

I found this but server-side only. Then I found this which seems WAAYYY more complicated than the v1 version implemented in the app
Hey @pastel cave , karbi had to step away for a bit. I can help, just need to catch up on this thread and your latest question

pastel cave
#

Thank you, just looking for documentation on generating client-side tokens for cards. The app I inherited uses v1 of the Stripe.js, which uses a pretty elementary method for generating card tokens. Karbi pointed me to v3 of the Stripe.js which I don't believe offers the same method (at least according to the API docs I'm looking at).

mellow turret
#

What is the method that v3 doesn't seem to have?

pastel cave
#

Stripe.createToken({...});

mellow turret
#

And to clarify, is the goal here is just to take client side info and create a card with it on a customer? Does it need to use tokens?

pastel cave
#

To be fair, I haven't tested it. Just didn't clearly see it in the docs.

#

Yeah just adding a card to an existing customer. Legacy app does it via client-side tokens, so I am replicating that.

#

Within the same app, just another endpoint/page.

mellow turret
#

And the current call is incompatible with what you are doing because it uses Stripe Elements?

pastel cave
#

Oh no current call works great, but its using v1 of the API. I figured it might be a good time to upgrade to the latest version of the API.

#

Just couldn't find any documentation about it, which we've run into before because this app is very old. So trying to be considerate of future devs by not propagating legacy stuff.

mellow turret