#jayrodrigues_docs
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/1298002958663028796
๐ Have more to share? Add more details, code, screenshots, videos, etc. below.
Below are links to other discussions we've had with you in the past week in case you want to review that information. If your question is related to one of these previous discussions, please provide a comprehensive summary of the current state and what you need help with now. We help many users simultaneously, so a summary allows us to resolve your issue as soon as possible.
- jayrodrigues_best-practices, 4 days ago, 13 messages
Hello, the Payment Element has some build in functionality for this
https://docs.stripe.com/payments/save-customer-payment-methods
Otherwise if you want to build your own checkbox that does this, you would update the setup_future_usage property on your payment intent as appropriate https://docs.stripe.com/api/payment_intents/update#update_payment_intent-setup_future_usage
Hey @sweet furnace
Right now we are migrating from the card element to the payment element. So when using the payment element, we need to utilize these parameters?
payment_method_redisplay: 'enabled',
payment_method_save: 'enabled',
payment_method_save_usage: 'on_session',
Correct
So those attributes are passed when we create a payment element?
https://docs.stripe.com/js/elements_object/create_payment_element
Apologies I misunderstood your last question. Those parameters aren't present in the payment element calls. You would be specifying this when creating the customer session https://docs.stripe.com/api/customer_sessions/object#customer_session_object-components-payment_element-features-payment_method_allow_redisplay_filters
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
Which payment element flow are you using right now? Do you create the payment intent before or after the payment element and does your confirmation happen on the client or server side?
I can send a doc that has instructions for this that are more specific to what you are working with
That's the card element we are using
And this is us now attempt to transition to the payment element
Gotcha, I am clear on which element you are using, but there are different ways to use that element. In all of those ways you will create a customer session at some point but how exactly you use the customer session changes based on how you are using the payment element
Which payment element flow are you using right now? Do you create the payment intent before or after the payment element and does your confirmation happen on the client or server side?
These questions will help me find the right doc to send you
Do you mind clarifying which confirmation you are referring to?
Do you mean what the customer sees when they submit a payment?
Just reviewed the code.
It seems that the payment intent is created before the payment element is rendered, and the actual payment confirmation happens later, after the user submits the form. The confirmation happens on the client side
Gotcha, thank you! This doc is about the flow you are using and here is the section about using the save payment method functionality that I linked to. Basically you will want to create the payment intent and customer session alongside each other and then pass the client secret for each to your elements create call https://docs.stripe.com/payments/accept-a-payment?platform=web&ui=elements#save-payment-methods
Wonderful, that helps @sweet furnace !
Do you think creating the payment intent after the payment element?
๐ stepping in for my teammate
Hey @quick talon thanks for stepping in
If you're asking whether it's possible to create a PaymentIntent after rendering the PaymentElement then yes, that's possible: https://docs.stripe.com/payments/accept-a-payment-deferred
Not asking if it's possible, I'm more asking what is the suggested / preferred option?
It really depends on what you're trying to do. Both the deferred intent flow and creating a PI first are valid approaches
In case it helps, some users who prefer the deferred intent flow do so because they want to introduce some additional logic before they create the PaymentIntent. For example, they want to collect payment details before presenting the user with the final charge amount/before confirming the payment
I can see how that's beneficial for a checkout experience.
For a use case, where the amount is predetermined, do you think the first option would be ideal?
And to make sure I understood corectly. With both options, I will have the ability to allow a customer to determine if they want their payment details saved in Stripe from the payment element, correct?
correct
First option being that you create the PaymentIntent first?
That's right
Okay. Yes, if the amount is predetermined and you don't necessarily need details about the user's payment method before confirming the amount, then yes, creating the PI first is a fine flow
In terms of implementation, which is usually "easier"
Both should be about the same level of effort, to be honest
We usually close threads ~20 minutes after they become inactive.
Got it
When we switched to payment elements, gettign this error in the console but worked fine for the card element. So when we enter a test credit card and click on submit, it just keeps showing processing...
[Stripe.js]
"You have not registered or verified the domain, so the following payment methods are not enabled in the Payment Element:
- apple_pay
Please follow https://stripe.com/docs/payments/payment-methods/pmd-registration to register and verify the domain."
Is the fact that nothing is happening on the front-end related to that warning or could it be somethign else?
It's likely something else since that warning is specifically about ApplePay, which I don't think you're using at the moment, correct?
That's right
What else could it be because the console log isn't showing anythign else
What is your code doing on button click?
When clicking, it's supposed to create a payment intent and process the payment
Can you provide more details? Can you share your frontend code for what happens after the button click?
@civic lake Do you still need help here?
Sorry @quick talon -trying to get you the informatino you requested.