How to secure a price passed to a payment gateway on client?

Using Javascript, say a customer buy a product that cost 10$ .

Many payment gateways, like PayPal and Stripe, offer a client side Form where you input the sale data (price, amount, buyer address, etc), and it’s being sent to the gateway (e.g PayPal) from the client side.

But, at this point when i fill the form using Javascript on the client side, someone can change the price from 10 to 1 and pay only 1 to PayPal.

I know things has to be validated on my server, but validation means that the server is sending back to client a response saying this price is good or not good, but this respond can also be manipulated.

So how is it that companies allow client side payment anyway using a form ? How/where the actual sale data is being passed to the payment gateway ? client? server?