#Nick Ortega-update-payment-intent
1 messages ยท Page 1 of 1 (latest)
Hi ๐ the amount parameter is provided each time you make a request to create a Payment Intent, so if you need to create ones with different amount values then you would adjust the value that you're providing for that parameter.
Is that what you were asking?
I'm not sure I understand. I have a text box so a customer can input an amount in and pay, then that amount will be updated thru elements.fetchUpdates() but doesn't seem to work
And I'm not sure if the amount parameter needs to be a string or if I can leave it as a variable?
Sounds like you may be doing things in the wrong direction. Are you making a request to update the Payment Intent before you have Elements fetch the updated information from the Payment Intent?
Yes I believe that is the order I am doing it in.
When you say it doesn't seem to work, can you elaborate on what you expected to happen that isn't? Could you also share the ID of a Payment Intent that you're using to test this flow?
I am creating a form that logs customer info, which is the customer obj (name, email, phone). Then I render in the Payment Element with the amount and description on top of the Payment Element.
But I when I test the form the amount nor the description gets updated in my Stripe Dashboard
Did you set up any event listeners on your form? What triggers when you make changes to those fields?
I have onChange event listener for both amount and description
near the bottom
But they don't update, I get the amount I already preset in the server side code
Do any of those trigger your backend to make a request to update the Payment Intent? That's what you'll need to do to update the Payment Intent, then you use fetchUpdates to pull the new details to your frontend.
https://stripe.com/docs/api/payment_intents/update
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
Uhhh no they do not trigger the backend to make a request. I update the request before those inputs are available, is that where I'm going wrong?
Likely, your client-side code is not allowed to directly update a Payment Intent, that request will need to be made by your server-side code using your secret key.
Okay just so I understand better
I will need to call my backend to update the details and send them to my front end?
No, the details are coming from your frontend so you don't not need to send them back to it, though you may need some indication the update request was successful to be provided back to your frontend. Once the Payment Intent has been updated, you can call fetchUpdate() from your frontend code to have elements pull in the updated information.
Nick Ortega-update-payment-intent
I am getting PaymentIntent in unexpected status message at the very bottom
I also have this on my server-side code as well.
๐ could you share the PaymentIntent ID that corresponds to the above status error message?
@final shard let me know if you still need help!