#laurenhawkes_code
1 messages ยท Page 1 of 1 (latest)
๐ Welcome to your new thread!
โฒ๏ธ We'll be here soon! Typically we respond in a few minutes, but sometimes we might take a bit longer if the server is busy or if you have a particularly tricky question.
โฑ๏ธ We close idle threads, which makes them read-only. Once a thread is closed it won't be reopened, but you can always start a new thread if you have another question.
๐ This thread will always be available, even after it's closed. You can find it again using Discord's search, or you can save this link: https://discord.com/channels/841573134531821608/1270327355872903180
๐ Have more to share? Add more details, code, screenshots, videos, etc. below.
Just seen ibn #help that the prior dev question is exactly the same ๐ be great to add example doc, happy to write one for you once I got it working.
Hi, let me help you with this.
Have you tried building this already? Are you running into any issues?
Yes I have got a customer with a paymentMethod with this flag filled in
Then using that customerId for a paymentIntent to load the Stripe elements block
But nothing appears
Docs suggest that perhaps It would show, but also seen on #1270315050829090941 query you suggested it wasn't possible?
Just wanted a clear answer so I don't time trying something to work that doesn't exist ๐
Please talk in this thread.
I'm here ๐
Re-displaying PMs on Payment Element is a new functionality. Before you were able to just charge it off-session, without involving the Customer to the session.
Which way do you actually want to do this?
On the PaymentElement
Actually both, but I'm comfortable doing off_session already and familiar with how that works.
Any other docus on how to implement the new functionality?
Perhaps I need configure something with this?
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
Not sure how I use that with a PaymentIntent?
Yes, you will need to create a Customer Session with this feature enabled: https://docs.stripe.com/api/customer_sessions/object#customer_session_object-components-payment_element-features-payment_method_redisplay
You create a PaymentIntent and then create a Customer Session for the same Customer. You can then send both client_secrets to the frontend to display the Payment Element.
Ok, appreciate it. Just need work out where the session_id goes on the payment element and will report back ๐
The Customer Session client_secret goes here: https://docs.stripe.com/js/elements_object/create#stripe_elements-options-customerSessionClientSecret
Make sense, it doesn't take an array of them though? I assume elements needs to know about the PaymentIntent (to make the payment) and the Session to be aware of the saved payment methods?
I guess session into customerSessionClientSecret ?
and PI as was before?
hi! I'm taking over this thread.
Make sense, it doesn't take an array of them though?
thecustomerSessionClientSecretis just as string, as mentioned in the doc
Got you
Maybe I am missing something, but from a DX perspective it would be great to just have this as a flag on the PaymentIntent opposed to required 2 API calls.
I'm not very familiar with this new feature, but there's probabbly a good reason why it's done this way.
Fair ๐ Always love what you guys are doing.
If you leave this thread open I can post a screenshot of how it looks with saved cards, i don't think this is currently available via the docs.
not sure I follow. you mean you would like the doc to include a screenshot?
I can share one for others looking here.
But yes also a docs specific for this would be awesome, i'm almost certain it has been custom built over 100k times with a saved card drop down + add new with Stripe elements.
Certainly something to shout about on Twitter once a "guide" docs are up ๐
makes sense! I'm sure there are plans for more docs about this new feature.
https://docs.stripe.com/payments/save-customer-payment-methods#display-existing-saved-payment-methods this docs suggests you don't need the session if paymentMethod has allow_redisplay?
interesting. give me a few minutes to run some tests.
FYI, I found some better doc here: https://docs.stripe.com/payments/accept-a-payment?platform=web&ui=elements#save-payment-methods
and based on this, looks like you have to use a CustomerSession, so the other doc might be missleading. I
Ok great.
Using this package https://www.npmjs.com/package/@stripe/react-stripe-js
Giving me this parameter: customerSessionClientSecret is not a recognized parameter.
Might be a problem how I am calling it, 2s
also make sure you are using the latest version of react-stripe-js
haha, well done ๐
Stripe has come along way since the old "drop in the stripe.js" attach to dom element days
Much appreciated ๐
happy to help ๐