php - Specify a fixed amount of money for a payment system that the user cannot change

First of all, I am a complete beginner when it comes to backend development.
I'm currently creating a webshop and have the whole thing hosted using Netlify.
The HTML code I am using for the webshop is (currently) static.

I am looking for a way to do payment processing for products.
I came across the following code on the internet (Source):

<form action="https://www.paypal.com/cgi-bin/webscr" method="post">
<input type="hidden" name="upload" value="1??? />
<input type="hidden" name="business" value="your-paypal@adress.com" />
<input type="hidden" name="currency_code" value="EUR"
<input type="hidden" name="item_name_1??? value="Desktop PC" />
<input type="hidden" name="amount_1??? value="79.00??? />
<input type="submit" value="PayPal" />
</form>

When clicking on the submit button, the buyer will be redirected to a page of Paypal and pay there the specified amount (the 79.00?��). But since the sum can be changed on client side, the user can adjust it to any sum.

How can I specify the amount of money without the client being able to change it?
I have already tried something with PHP, however it seems that PHP does not work on Netlify.

I have also already added readonly to the responsible input tag. However, I can still change the sum.

So is there any way to set the money amount so that the client can't change it?
Or are there already completely different ways to set up payment forwarding for PayPal these days?

Answer

Solution:

For the client not to be able to change the amount you need a server-side integration, plain and simple.

Create two routes, one for 'Create Order' and one for 'Capture Order', documented here. These routes should return JSON data.

Pair your two routes with the following approval flow: https://developer.paypal.com/demo/checkout/#/pattern/server


Edit: There is also a much older and simpler solution, though it doesn't give a modern checkout experience: you could create hosted 'Buy Now' or 'Add to Cart' button via https://www.paypal.com/buttons . The generated <form> code will have a "hosted_button_id", and its amount is stored at PayPal. This way the buyer can't change it.

Source