#mkoenke

1 messages · Page 1 of 1 (latest)

late sonnetBOT
dull edge
#

Hi there!

coral venture
#

hello!

dull edge
#

is it possible/advisable to update that amount either through PaymentIntent.update
Yes
or during the stripe.confirmPayment step?
No, it can only be done from the backend with a secret key, otherwise anyone would be able to change the amount they pay

coral venture
#

ok great to know, and we should use PaymentIntent.update to do this, right?

#

trying to work through the use case of someone adding a promotion code, so the price changes after we create the payment intent

#

The currency should not be updated though, if I understand correctly, because the methods of payment displayed using the PaymentElement are based off of the currency. Is that correct?

dull edge
coral venture
#

very interesting!! thats great! Our current integration is such that the product is chosen on our checkout page, where the Elements instance is already rendered. Once the product is chosen and the card information is entered by the user into the Card Element, we create the payment method and the amount and currency is determined. We pass this information to the server side, do a bunch of validations and then perform Stripe::PaymentIntent.create with all the necessary information for the charge to be processed. We do not do the two separate steps of PaymentIntent.create and then confirmCardPayment on the client side. So we are trying to figure out how to switch over to using the PaymentElement, if we do not know the currency until the card is input, being that we need to enter the client_secret into the Elements instance, which would already be rendered at that point. But if we can create a payment intent first, and then update the amount and currency later, and refresh the Payment Element, once we have the information from the buyer, it might work

dull edge
#

Yes basically you have two main options:

  • First let the customer pick exactly what they want (to know the amount and currency). And only then create the PaymentIntent and render the Payment Element
  • Otherwise if you don't know in advance (or maybe you know but the customer can change it), then update the PaymentIntent from the backend and refresh the Payment Element on the frontend
coral venture
#

this is so helpful, thank you so much!!