#xh.liang

1 messages · Page 1 of 1 (latest)

strong condorBOT
pseudo palm
#

Hi, if you have a Customer which already have saved Payment Methods, and specify that customer id when you create this Checkout Session, then it will be displayed here

marble rain
#

Does stripe-js sdk provide method to load users' payment info by customer id?

pseudo palm
#

Yes it's the server-side way. This require the setup from backend

marble rain
#

For example,I have a spa web application developed by React. And I use stripe.js sdk (https://stripe.com/docs/js). So how can i associate payment info (show card info in the Input element) with current user?

The client side talk with backend with restful api.

#

@pseudo palm

pseudo palm
#

It's the steps to be done in your backend, so you don't need to modify your React SPA app. On backend, simply follow 2 steps I mentioned above

#

Then in your SPA app, after you let your customer redirect to Stripe Checkout page, we will automatically display the saved Payment Methods on that customer

marble rain
split meteor
#

we don't have any standalone component for showing a customer's payment methods no

#

so you can either redirect to Checkout with a supplied customer ID, or you can build your own UI for showing the customer their saved cards and picking one, by calling https://stripe.com/docs/api/payment_methods/customer_list and sending information to your frontend web page where you can use the details like card.brand / card.last4 etc to build some list/table view in your page

marble rain
#

In fact, we want build our custom ui with create element method provided by stripejs

split meteor
#

not sure what that has to do with the answer I gave

marble rain
split meteor
#

correct, you can not

#

the only way to build this is what I said above. You send information to your frontend web page where you can use the details like card.brand / card.last4 etc to build some list/table view in your page.
When the user picks something in that list, instead of using Elements or a CardElement or anything like that, you would directly call e.g. https://stripe.com/docs/js/payment_intents/confirm_card_payment#stripe_confirm_card_payment-existing with the ID pm_xxx of the card they picked from that list/table view

marble rain
#

ok i will try it later.

proud briar
#

Hey, taking over here. Let me know if there's any follow-up Qs I can answer!