Dynamic PayPal button generation - isn't it very insecure?

前端 未结 6 531
情话喂你
情话喂你 2020-11-29 21:06

I am just wondering here.. Aren\'t the PayPal buttons that are dynamically created, very unsecure, and easily \"hackable\"?

Like so:

6条回答
  •  臣服心动
    2020-11-29 21:51

    I think I have a solution for this issue:
    First, submit to PayPal from a secure page - Public SSL.

    Second, you can use Ajax in order to prevent users to brows your HTML code via "Right Click - View Source" or browsers Tools like Fire-Bug.

    Here is an example in jQuery:
    I usually program with C#.NET so this is why I communicate with a .ashx Generic Handler (but it can work with PHP as well)

    $(function () {

    $.ajax({  
               type: "POST",  
               url: "myPage.ashx",  
               data: {  
                   theProductsIdAndAmountsString: yourValue  
               },
               success: function (allHtmlCode) {
                   $("body").append(allHtmlCode);
                   $("form").submit();
               }
           });
       });
    

    In the server side you can generate all the HTML form by pooling the data from your Data Base, Then send it back to the page.
    After, append it to the body and submit the form to PayPal.

    Now no one can use browser tools like Fire-Bug to change your HTML values.

提交回复
热议问题