#mayhul-paymentelement-migration

1 messages · Page 1 of 1 (latest)

runic flame
#

It is not possible no since it needs information about the PaymentIntent itself to render (such as the amount, payment methods enabled, etc.)

ashen island
#

This is what our current payment component looks like. Does this mean it's impossible to replicate this set up with the new Payment Element?

The user is able to simultaneously enter their payment information & choose a payment plan. Any recs on what we could do here? Do we need to rearchitect our component if we want to migrate?

#

A more real example of how this is used in practice:

runic flame
#

You can do this, but you need the PaymentIntent to be created on load and initialized with the option you select by default basically

ashen island
#

Gotcha, so instead of generating the PaymentIntent on submit, we generate it on load + whenever the user changes the selected Payment option?

#

How does that work with subscriptions? Right now when the user clicks submit, we create a subscription, which generates a PaymentIntent as a byproduct. Would this new set up mean that an "empty" subscription is generated every time the user switches the selected Plan option?

runic flame
#

yeah when they change the option you can update the PaymentIntent's amount for example

#

If you are using Subscription then it's completely different

#

You can't do an "empty subscription", that's not a thing, and once it's created you can't "change" the subscription

#

So you have to reword your UI completely I'd say to have them choose the "plan" they want first, then you create the subscription, get the associated PaymentIntent and render the PaymentElement

ashen island
#

Our current set up does the following: User clicks "Pay Now" -> Send the plan ID to the server -> Server creates a subscription for that plan -> Get the paymentIntent from the first invoice for that subscription -> Send the client secret to the front end -> Pass the secret to stripe.confirmCardPayment

#

This allows us to render the CardElement before the user has finalized their plan decision

#

It sounds like what you're saying is that if we migrate to PaymentElement, we can't do that anymore. We need to instead make the user finalize a plan THEN enter in their payment information. Is that correct?

runic flame
#

yes

ashen island
#

ok, that's unfortunate. Appreciate the help!