#Berci
1 messages · Page 1 of 1 (latest)
Hi there. What issue are you having specifically?
Hi!
So I want to modify the amount in the paymentintent.create script with a variable from another script
How can I do that?
Like when someone chooses a product and presses buy button, it creates a paymentintent with the product's price
Where is the amount variable coming from? What script?
From another script, I want to set the choosen option's id for the amount
So when it's choosed and a specific buy button is pressed, create a paymentintent with this id's value
You'd just need to pass it in the body of the POST request
And grab that in your backend code
I don't have a lot coding experience, can you show me a code for that?
But that's not a very secure way of doing things since the request can be tampered with
Is there any better way?
Unfortunately we can't code an integration for you or teach concepts. We are just here to help developers with their Stripe-related API questions. I recommend you learn the basics first
This is a good starting point: https://stripe.com/docs/payments/accept-a-payment?platform=web&ui=elements
But you need to learn the coding basics first
Which part? You just want to know how to pass an amount in a request body?
It's not necessarily unsafe. You can do it that way, but you're going to want to do server side validation
ie only create the payment intent if they pass an amount that is valid/what you're expecting
I see
But post requests aren't a stripe concept. You really need to learn the basics first: https://developer.mozilla.org/en-US/docs/Web/HTTP/Methods/POST