#astrodude42_best-practices
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/1219205089714114590
š Have more to share? Add more details, code, screenshots, videos, etc. below.
Is the question about how to display saved payment methods in payment element?
Thanks for the quick response! The question is about how to use the data provided by our backend (mentioned above) with the credit card information entered by a user (using a custom form made of Stripe Elements) and complete the payment on the web, using StripeJS API
https://docs.stripe.com/payments/accept-a-payment?platform=web&ui=elements you can follow this guide to get started. Note that ephemeralKey isn't required for a web integration.
Thanks for leading me to this page. I read about the Payment Element. Unfortunately, the customer i work for wants a custom form design made up of Stripe Elements, not the Payment Element. Would that be possible at all?
You mean Card Element? https://docs.stripe.com/payments/payment-card-element-comparison
No, i wasn't aware of Card Element. Currently, every credit card payment form on our side is strictly made with Stripe Elements API. I.e.
import { loadStripe } from '@stripe/stripe-js'
const stripe = await loadStripe(STRIPE_PUBLIC_KEY)
const stripeElements = stripe.elements({
ā¦,
clientSecret,
})
const cardNumber = stripeElements.create('cardNumber', ā¦)
const cardExpiry = stripeElements.create('cardExpiry', ā¦)
const cardCvc = stripeElements.create('cardCvc', ā¦)
cardNumber.mount(`#cardNumber`)
cardExpiry.mount(`#cardExpiry`)
cardCvc.mount(`#cardCvc`)
Hey! Taking over for my colleague. You have two options:
- Use PaymentElement and customize the style using the Appearance API https://stripe.com/docs/elements/appearance-api
- Use the separate card elements same way you are using now
Here is a comparasion between both options
https://docs.stripe.com/payments/payment-card-element-comparison
Hi š
ok, what about the general goal of implementation to replicate StripePaymentSheet from the Stripe iOS SDK which doesn't exist in StripeJS? Our backend creates the PaymentIntent and provides the data which is necessary for the iOS StripePaymentSheet (clientSecret, customerId, ephemeralKey and paymentIntentId). How can i reuse that data in the StripeJS API? Because this data identifies the PaymentIntent that needs to be completed by the web-UI.
if i were to create a SetupIntent instead of a PaymentIntent and use our custom Elements form, i would use confirmCardSetup (https://docs.stripe.com/js/setup_intents/confirm_card_setup). What would be the equivalent for PaymentIntent?
How can i reuse that data in the StripeJS API?
In stripe Js you don't need to use theephemeralKey, you need just the payment_intent.client_secret
https://docs.stripe.com/payments/accept-a-payment?platform=web&ui=elements
if i were to create a SetupIntent instead of a PaymentIntent and use our custom Elements form, i would use confirmCardSetup
You need to use confirmSetup:
https://docs.stripe.com/js/setup_intents/confirm_setup
I strongly recommend you to follow this guide:
https://docs.stripe.com/payments/save-and-reuse?platform=web&ui=elements
What would be the equivalent for PaymentIntent?
Just follow the same guide above, you need to use confirmPayment
https://stripe.com/docs/js/payment_intents/confirm_payment
https://docs.stripe.com/payments/accept-a-payment?platform=web&ui=elements
thank you very much! i guess that's what i was missing. will look into it right now and come back later if there are any related questions