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

前端 未结 6 528
情话喂你
情话喂你 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:57

    You should use the PayPal Button API such as below:

    $sendPayData = array(
        "METHOD" => "BMCreateButton",
        "VERSION" => "65.2",
        "USER" => "username",
        "PWD" => "password",
        "SIGNATURE" => "abcdefg",
        "BUTTONCODE" => "ENCRYPTED",
        "BUTTONTYPE" => "BUYNOW",
        "BUTTONSUBTYPE" => "SERVICES",
        "BUTTONCOUNTRY" => "GB",
        "BUTTONIMAGE" => "reg",
        "BUYNOWTEXT" => "BUYNOW",
        "L_BUTTONVAR1" => "item_number=$invoiceNumber",
        "L_BUTTONVAR2" => "item_name=$invoiceType",
        "L_BUTTONVAR3" => "amount=$invoiceTotal",
        "L_BUTTONVAR4" => "currency_code=GBP",
        "L_BUTTONVAR5" => "no_shipping=1",
        "L_BUTTONVAR6" => "no_note=1",
        "L_BUTTONVAR7" => "notify_url=http://www.abc.co.uk/paypal/ipn.php",
        "L_BUTTONVAR8" => "cancel_return=http://www.abc.co.uk/paypal/thanks",
        "L_BUTTONVAR9" => "return=http://www.abc.co.uk/paypal/return.php"
    );
    

    You can then send that with cURL to their API

    $curl = curl_init();
    curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
    curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false);
    curl_setopt($curl, CURLOPT_URL, 'https://api-3t.paypal.com/nvp?'.http_build_query($sendPayData));
    $nvpPayReturn = curl_exec($curl);
    curl_close($curl);
    

    To then generate a encrypted HTML button that cannot be edited

     
     
    
     
     
    

    These links should help you with the button options:

    https://cms.paypal.com/us/cgi-bin/?cmd=_render-content&content_ID=developer/e_howto_api_nvp_BMCreateButton

    https://cms.paypal.com/us/cgi-bin/?cmd=_render-content&content_ID=developer/e_howto_api_ButtonMgrAPIIntro

提交回复
热议问题