I am just wondering here.. Aren\'t the PayPal buttons that are dynamically created, very unsecure, and easily \"hackable\"?
Like so:
You're right - dynamic PayPal buttons are easily "hackable" if you pass, for example, the price of the product in clear text.
However, PayPal supports public-key button encryption, so that the relevant details can not be easily altered. This is the way it works:
This way, as long as your private key is uncompromised, no one will be able to alter the transaction's details.
More information and detailed instructions are available at https://cms.paypal.com/us/cgi-bin/?cmd=_render-content&content_ID=developer/e_howto_html_encryptedwebpayments#id08A3I0P017Q. (Although PayPal provides its software to generate encrypted buttons, I think it's possible to create them "on the fly" using appropriate functions, such as openssl_*()
in PHP; I haven't tested them personally).
An alternative would be implementing Instant Payment Notification (https://cms.paypal.com/us/cgi-bin/?cmd=_render-content&content_ID=developer/e_howto_admin_IPNIntro); you could check that the amount of the transaction performed by the user equals the total order amount.