#erik_paymentintent-twosteps
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/1304471137693995028
๐ 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.
- erikshestopal_best-practices, 1 hour ago, 10 messages
Primary issue is that I can't pass this to paymentMethodOptions in the Elements component
const options: StripeElementsOptions = {
mode,
// setupFutureUsage,
amount: amountInCents,
currency: currencyCode,
paymentMethodCreation: "manual",
loader: "always",
paymentMethodConfiguration: paymentMethodConfigurationId,
onBehalfOf: vendorId,
paymentMethodOptions: { card: { setupFutureUsage: true } } // does not work
}
Hi, this is expected and Affirm does not support future usage: https://docs.stripe.com/payments/affirm
I'm not sure it's expected and I understand that Affirm doesn't support future usage.
Like I mentioned before, I was able to make this work by creating the payment intent upfront, specifying payment_method_options: { card: { setup_future_usage: true } }, as part of the intent payload, and then using a clientSecret to initialize the Elements component.
creating the payment intent upfront allowed me to have setup future usage work for the credit card AND also show Affirm without future usage.
Did you attempt to process the payment with Affirm in that flow?
If so, can you share the example request id where you created this? Here's how you can find a request ID: https://support.stripe.com/questions/finding-the-id-for-an-api-request
Yes ๐ That's the way it's working in production right now.
Can you share an id with me?
That works, I'm testing this on my end in the meantime
Oh, you're setting the setup_future_usage within the card payment method and not on the main level. Ok, that makes sense.
I see, now I'm following you. Yeah, that is not possible with the two step confirmation flow. We document what elements you can pass here: https://docs.stripe.com/payments/build-a-two-step-confirmation#additional-options and payment_method_options: { card: { setup_future_usage: true } } is not an option. I will share your feedback with the product team for future product reiterations.
๐ฆ
Well, good to know that I've hit a brick wall at least. Thank you for responding.
I think your flow makes sense where you want to show both payment methods but only use setup future usage for card payment methods only. The above flow was build so merchants can add more logic in their flow. For instance, if they provide a certain payment method, they would inspect the payment method and decide not to proceed with the payment for instance.
I have a followup - please don't lock the thread yet.
Sure!
@midnight sparrow checking in here, can you share your follow-up question here?
For context, the reason I need a two step workflow is because I want to update the payment intent with a dynamic application fee because on the payment method used. If Affirm is used, I want to charge a higher fee rate.
One option that comes to mind is to add a listener to the elements component and send a request to the backend API to update the payment intent based on the payment method being used.
What are your thoughts on that?
You might get an error stating there there is a mismatch, you can test it on your end to confirm
Mismatch on what?
Oh wait, you're saying you would update the PaymentIntent with an Application fee?
yes
Yeah, you can test that. I was thinking you might change the setup future usage, and that might erorr out.
If you're updating the amount it's different
Sorry for the confusion
I wouldn't be changing the setup future usage, just the application fee.
erik_paymentintent-twosteps
Any other options I should consider for dynamically updating a payment intent's application fee based on which payment method was used?
Sorry, is the option we gave you not working? Do you have an exact error where it doesn't work?
Which option are you referring to?
One option that comes to mind is to add a listener to the elements component and send a request to the backend API to update the payment intent based on the payment method being used.
this was my suggestion and I was asking if there are other alternatives to consider ๐
You were talking with my colleague and they seemed to align with you on next steps and told you to try it
1/ Render PaymentElement
2/ Create a ConfirmationToken
3/ Go to your server, inspect it, decide on your ApplicationFee amount based on the payment method chosen and confirm the PaymentIntent
That approach doesn't work as we determined a bit earlier - #1304471137693995028 message
I was asking something slightly different.
It doesn't work because I have a further requirement of dynamic payment methods. Unless you have a different idea that I can try for my original inquiry, I will have to resort to updating the payment intent's application fee in response to the change event on the Elements component.
I have a further requirement of dynamic payment methods
what does that mean?
Okay I read your original question and I get the problem now.
There's context in the thread above ๐
If I can clarify something not already written above, happy to do so
So yeah the change event is the only thing I can think of