#fiery_papaya_08623
1 messages · Page 1 of 1 (latest)
Hello fiery_papaya_08623, 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.
• fiery_papaya_08623, 0 days ago, 5 messages
• fiery_papaya_08623, 0 days ago, 21 messages
• fiery_papaya_08623, 0 days ago, 6 messages
HI 👋
You need to update the Elements instance from the Intent to reflect the new amount
Tried it and it does not seem to work...
After updating the amount and calling elements.fetchUpdates();, its still showing the orignial amount. When the user confirms payment, the amount charged is the correct amount, but the amount showed is not the correct one
Hello! I'm taking over and catching up...
What specific Stripe Element are you using for Apple Pay?
I use this hook const elements = useElements();
of this library @stripe/react-stripe-js
Right, but are you using the Payment Element? Payment Request Button? Express Checkout Element?
I use Payment Element
You need to call elements.update() and provide the new amount: https://stripe.com/docs/js/elements_object/update#elements_update-options-amount
I see the documentation but these are my only option sfor the update method
Maybe you need to update the library you're using?
Ok yes I just upgraded it and the other options are showing now thanks! I now see this error when trying to update the elements but not sure why
You're specifying both a client secret and also indicating you're using the deferred flow. Those are not compatible approaches, so you're getting that error.
This is my line :
elements.update({ amount: paymentIntent.totalAmount, mode: "payment", currency: "cad" });
I used this guide: https://stripe.com/docs/stripe-js/react?locale=fr-CA
So it sounds like you're probably initializing with a client secret. How are you updating the amount on the Payment Intent?
Yes I do Sorry ! I make an api request to my backend and it updates the amount of the payment intent. In my frontend, I show to the user the updated amount, but when it comes to pay with apple pay, it shows the original amount
In that case the elements.fetchUpdates() is what you need, and it should update the amount shown: https://stripe.com/docs/js/elements_object/fetch_updates
But you said it doesn't work?
No it did not.. after making my request, it updated the payment intent correctly, but still showed the original amount in apple pay
Hi @wooden mauve I'm taking over this thread.
Hi! Thank you
I'm unable to reprodce your problem, the Apple Pay paymentsheet shows the updated amount after I call elements.fetchUpdates()