1

我在为客户的网站创建 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>";

/* 这是源代码——你可以看到没有发票号码通过,价格和数量为零,地址在那里,但没有通过贝宝。运费也在那里。*/

<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>
4

1 回答 1

0

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

于 2013-01-13T23:49:14.377 回答