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
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="[email protected]" /> <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?
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.
Our community is visited by hundreds of web development professionals every day. Ask your question and get a quick answer for free.
Find the answer in similar questions on our website.
Do you know the answer to this question? Write a quick response to it. With your help, we will make our community stronger.
PHP (from the English Hypertext Preprocessor - hypertext preprocessor) is a scripting programming language for developing web applications. Supported by most hosting providers, it is one of the most popular tools for creating dynamic websites.
The PHP scripting language has gained wide popularity due to its processing speed, simplicity, cross-platform, functionality and distribution of source codes under its own license.
HTML (English "hyper text markup language" - hypertext markup language) is a special markup language that is used to create sites on the Internet.
Browsers understand html perfectly and can interpret it in an understandable way. In general, any page on the site is html-code, which the browser translates into a user-friendly form. By the way, the code of any page is available to everyone.
Welcome to the Q&A site for web developers. Here you can ask a question about the problem you are facing and get answers from other experts. We have created a user-friendly interface so that you can quickly and free of charge ask a question about a web programming problem. We also invite other experts to join our community and help other members who ask questions. In addition, you can use our search for questions with a solution.
Ask about the real problem you are facing. Describe in detail what you are doing and what you want to achieve.
Our goal is to create a strong community in which everyone will support each other. If you find a question and know the answer to it, help others with your knowledge.