开发者

php - paypal doesn't accept 'amount' I pass it

开发者 https://www.devze.com 2023-02-26 16:59 出处:网络
First time on here, am having an issue with a website I am writing in php.I am trying to get Paypal to accept a single payment passing it the values below.I used their Create Button tool, and added a

First time on here, am having an issue with a website I am writing in php. I am trying to get Paypal to accept a single payment passing it the values below. I used their Create Button tool, and added a few extra fields. The $idTeacher field passes through to paypal perfectly, but the $MaxHourlyR开发者_JAVA百科ate does not (they both exist however, as I can echo them). Any advice would be greatfully received:

echo "<table border='1' cellpadding='0' cellspacing='1'>";
echo "<tr><td>Passed #</td><td>#Contract</td><td>Language</td><td>Language Level</td><td>PLZ</td><td>Frequency</td><td>Max Hourly Rate</td><td>Reserve Contract</td></tr>";

while($row = mysql_fetch_array($pendingcontractsql)){
$idContract = $row['idContract'];
$Language = $row['Language'];
$LanguageLevel = $row['LanguageLevel'];
$PLZ = $row['PLZ'];
$Frequency = $row['Frequency'];
$MaxHourlyRate = $row['MaxHourlyRate'];


echo "<tr>";
echo "<td>$MaxHourlyRate</td><td>".$row['idContract']."<td>".$row['Language']."</td><td>".$row['LanguageLevel']."</td><td>".$row['PLZ']."</td><td>".$row['Frequency']."</td><td align='right'>".$row['MaxHourlyRate']."CHF</td><td align='center'>
<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='brettstirling@gmail.com'>
<input type='hidden' name='quantity' value='1'>
<input type='hidden' name='no_note' value='1'>
<input type='hidden' name='no_shipping' value='1'>
<input type='hidden' name='currency_code' value='CHF'>
<input type='hidden' name='item_name' value='Payment for Contract #".$idContract."'>
<input type='hidden' name='item_number' value='$idContract'>
<input type='hidden' name='amount' value='$MaxHourlyRate'>
<input type='hidden' name='discount_rate' value='50'>
<input type='hidden' name='notify_url' value='http://www.findateacher.ch/paypalipn.php'>
<input type='hidden' name='return' value='http://www.findateacher.ch/availablecontract.php'>
<input type='hidden' name='rm' value='2'>
<input type='hidden' name='cbt' value='Return to Find A Teacher'>
<input type='hidden' name='hosted_button_id' value='LRABWTJVH7N36'>
<input type='submit' border='0' name='submit' value='Reserve Contract'>
</form>
</td>";
echo "</tr>";
}

echo "</table>";

Many thanks in advance, Brett


Try to change the field name to AMT rather than amount.

Let me know if that works.


I had a similar problem and changed

<input type='hidden' name='cmd' value='_s-xclick'>

to

<input type='hidden' name='cmd' value='_xclick'>

Worked for me more than once. Hope this helps. Let me know if that works.


I resolved by changing the button to a non-hosted button - you can pass as many variables as you want then...thanks for all the advice though


Careful about switching the button values around -- they do different things. I imagine you've seen it, but if not, check this variable reference for Website Payments Standard

I'd verify that you're passing a number with exactly two decimals of precision -- if you've a whole integer it needs to be x.00; if it's more precise than that, you need to round the value to two decimal places (for some of the paypal API's, at least: I'm not sure specifically about this product but I expect it's the same). Couldn't hurt to sanitize the data from the row select either to make sure that it's actually a X.xx number and not something weird like $X.xx that'll trip up the PayPal API

@Teodor Talov: AMT is what PayFlow and the NVP API's use, but it looks like 'amount' is correct for Website Payments Pro/Standard.

The taxonomy of PayPal products, documentation and API's is often infuriating. Good luck =)

0

精彩评论

暂无评论...
验证码 换一张
取 消