Paypal立即购买按钮传递一些变量,但不是全部

时间:2013-01-10 03:27:23

标签: php paypal

我有一个问题,我正在为客户的网站创建Paypal立即购买按钮。名字,姓氏,电子邮件地址和项目名称正在进行中,但是帐单地址和价格都在经历。什么应该是一个简单的过程非常奇怪。这是我的代码:

$invoicenumber = $row['InvoiceNumber'];
$totalquantity = $row['TotalQuantity'];
$totalprice = $row['TotalPrice'];
$costofshipping = $row['CostOfShipping'];
$firstname = $row['FirstName'];
$lastname = $row['LastName'];
$billingstreetaddress = $row['BillingStreetAddress'];
$billingapartmentnumber = $row['BillingApartmentNumber'];
$billingcity = $row['BillingCity'];
$billingstate = $row['BillingState'];
$billingzipcode = $row['BillingZipCode'];
$emailaddress = $row['EmailAddress'];
echo "<form action='https://www.paypal.com/cgi-bin/webscr' method='post'>
<input type='hidden' name='cmd' value='_s-xclick'>
<INPUT TYPE='hidden' NAME='business' VALUE='payments@companyname.com'>
<INPUT TYPE='hidden' NAME='invoice' VALUE='$invoicenumber'>
<INPUT TYPE='hidden' NAME='undefined_quantity' VALUE='$totalquantity'>
<INPUT TYPE='hidden' NAME='item_name' VALUE='CompanyNamePurchase'>
<INPUT TYPE='hidden' NAME='amount' VALUE='$totalprice'>
<INPUT TYPE='hidden' NAME='shipping' VALUE='$costofshipping'>
<INPUT TYPE='hidden' NAME='currency_code' VALUE='USD'>
<INPUT TYPE='hidden' NAME='first_name' VALUE='$firstname'>
<INPUT TYPE='hidden' NAME='last_name' VALUE='$lastname'>
<INPUT TYPE='hidden' NAME='address1' VALUE='$billingstreetaddress'>
<INPUT TYPE='hidden' NAME='address2' VALUE='$billingapartmentnumber'>
<INPUT TYPE='hidden' NAME='city' VALUE='$billingcity'>
<INPUT TYPE='hidden' NAME='state' VALUE='$billingstate'>
<INPUT TYPE='hidden' NAME='zip' VALUE='$billingzipcode'>
<INPUT TYPE='hidden' NAME='lc' VALUE='US'>
<INPUT TYPE='hidden' NAME='email' VALUE='$emailaddress'>
input type='hidden' name='hosted_button_id' value='paypalclientnumber'>
<input type='image' id='paypalsubmitbutton' style='top:750px;left:65%;position:absolute;'     src='https://www.paypalobjects.com/en_US/i/btn/btn_buynowCC_LG.gif' border='0'    name='submit' alt='PayPal - The safer, easier way to pay online!'>
<img alt='' border='0' src='https://www.paypalobjects.com/en_US/i/scr/pixel.gif'    width='1' height='1'>
</form>";

/ *这是源代码 - 因为你可以看到没有发票号码,价格和数量都是零,地址在那里,但没有通过paypal。运输成本也在那里。 * /

<form action='https://www.paypal.com/cgi-bin/webscr' method='post'>
<input type='hidden' name='cmd' value='_s-xclick'>
<INPUT TYPE='hidden' NAME='business' VALUE='payments@companyname.com'>
<INPUT TYPE='hidden' NAME='invoice' VALUE=''>
<INPUT TYPE='hidden' NAME='undefined_quantity' VALUE='0'>
<INPUT TYPE='hidden' NAME='item_name' VALUE='CompanyNamePurchase'>
<INPUT TYPE='hidden' NAME='amount' VALUE='0.00'>
<INPUT TYPE='hidden' NAME='shipping' VALUE='7.00'>
<INPUT TYPE='hidden' NAME='currency_code' VALUE='USD'>
<INPUT TYPE='hidden' NAME='first_name' VALUE='Multigrain'>
<INPUT TYPE='hidden' NAME='last_name' VALUE='Cheerios'>
<INPUT TYPE='hidden' NAME='address1' VALUE='2 Spoonful Way'>
<INPUT TYPE='hidden' NAME='address2' VALUE='myemailaddress@email.com'>
<INPUT TYPE='hidden' NAME='city' VALUE='Brooklyn'>
<INPUT TYPE='hidden' NAME='state' VALUE='New York'>
<INPUT TYPE='hidden' NAME='zip' VALUE='11203'>
<INPUT TYPE='hidden' NAME='lc' VALUE='US'>
<INPUT TYPE='hidden' NAME='email' VALUE=''>
<input type='hidden' name='hosted_button_id' value='paypalidjumbledletters&#s'>
<input type='image' id='paypalsubmitbutton'     style='top:750px;left:65%;position:absolute;' src='https://www.paypalobjects.com/en_US/i/btn/btn_buynowCC_LG.gif' border='0' name='submit' alt='PayPal - The safer, easier way to pay online!'>
<img alt='' border='0' src='https://www.paypalobjects.com/en_US/i/scr/pixel.gif' width='1' height='1'>
</form>

1 个答案:

答案 0 :(得分:0)

除了确保按钮是非托管按钮之外,如果您在传递地址变量时遇到问题,请确保缩写状态,即MA而不是马萨诸塞州。这对我来说是解决方案。