#bachir2921
1 messages · Page 1 of 1 (latest)
Hello! We'll be with you shortly. 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.
- bachir-paymentintent-confirmation, 16 hours ago, 8 messages
- bachir-subscription-manual3ds, 1 day ago, 19 messages
- bachir-3ds-manual, 1 day ago, 12 messages
Hi there!
You can set the PaymentMethod directly when creating the PaymentIntent: https://stripe.com/docs/api/payment_intents/create?lang=node#create_payment_intent-payment_method
Hi, this is the API right ? I'm talking about the client JS component that displays the payment methods based on the account configured payment methods https://stripe.com/docs/payments/payment-element
Oh so you mean changing the paymnet method directly on the frontend?
Yes, I'd like to be able for example to say to hide the "PayPal" one based on some conditions in the frontend
You can change the order of PaymentMethod: https://stripe.com/docs/js/elements_object/create_payment_element#payment_element_create-options-paymentMethodOrder
You can disable wallets: https://stripe.com/docs/js/elements_object/create_payment_element#payment_element_create-options-wallets
But I don't see a way to disable/enable other payment method directly on the frontend. One option is to:
- Update the PaymentIntent on the backend
- And then refresh the PaymentElement with https://stripe.com/docs/js/elements_object/fetch_updates
Oh ok that's interesting I didn't realize the PaymentElement was linked to the payment intent. So the payment intent should be created before we render the PaymentElement on the frontend, right ?
Oh wait, actually it depends. Which flow are you using with the PaymentElement?
- The regular flow: https://stripe.com/docs/payments/accept-a-payment?platform=web&ui=elements
- Or the defered flow: https://stripe.com/docs/payments/accept-a-payment-deferred
For now we are still using the CardElement, and looking to migrate to the PaymentElement. We use the deferred flow : we collect the payment method then creating the payment intent using the payment method ID.
This could be changed though if it allows us to control the displayed payment methods in the PaymentElement
Thanks for the clarification, looking into this...
The only way to do this in deferred flow is to opt out of automatic PMs and pass paymentMethodTypes to your Elements object: https://stripe.com/docs/payments/accept-a-payment-deferred?platform=web&type=payment#additional-options
Ok! Would you recommend using the regular flow ? Would that work with subcriptions too ?
Would you recommend using the regular flow ?
It depends really. Can you elaborate more on your use case?
Would that work with subcriptions too ?
Yep both deferred and non-deferred flows work with recurring and one-time payments
It depends really. Can you elaborate more on your use case?
We process payments for non-profits. So donors come on forms we host that non-profit have created on our platform, fill in an arbitrary amount for a donation then pay. We then transfer this amount to the non-profit stripe balance. They can also make recurrent (monthly, yearly) donations. We provide card, ACH, Pre-authorized debit payment methods.
We'd like to use the PaymentElement component to modernize our UI, take leverage of integrating new payment methods automatically through Sdtripe and simplify our frontend flow when handling non-card payment methods.
Either flow would work in this scenario. I guess it'd depend on how you arcitect your checkout flow. I can imagine a scenrio where a donor ultimately changes the amount they want to donate, which the deferred flow is better suited for (as then you won't need to back backend calls to update the existing Payment Intent)
Indeed - i'll try to integrate it using our current flow.
Now I'm trying to instantiate the PaymentElement following this https://stripe.com/docs/payments/quickstart?client=react, but it seems like I need the payment intent secret in order to instantiate the component : so I need to create a payment intent at the beginning of the flow ?
Well, that's the non-deferred flow. If you're going that route yes you need a PI before you can initialise the Payment Element
Should I follow this instead ? https://stripe.com/docs/payments/accept-a-payment-deferred
Yup
Alright, thanks for your help!