0

我已经开发了自己的购物车,现在我想在用户单击结帐按钮后集成 Paypal。

我需要根据客户添加到购物车的内容将项目详细信息传递给 Paypal。我相信我下面的代码可以做到这一点,但是点击结帐按钮时什么也不做。尝试了一切,但由于某种原因,表单甚至没有看到结帐按钮!

<?php
$checkout = "<form action='https://www.paypal.com/cgi-bin/webscr' method='post'>";
$checkout .= "<input type='hidden' name='cmd' value='_cart'><input type='hidden' name='upload' value='1'>";
$checkout .= "<input type='hidden' name='business' value='craig@biosboss.com'>";

$count = 1;
$checkout .= "<input type='hidden' name='item_name_" + $count + "' value='" + $item['name']+ "'>";
$checkout .= "<input type='hidden' name='item_number_" + $count + "' value='" + $count + "'>";
$checkout .= "<input type='hidden' name='quantity_" + $count + "' value='" + $item['qty'] + "'>";
$checkout .= "<input type='hidden' name='amount_" + $count + "' value='" + $item['price'] + "'>";
$count = $count + 1;
?>

<input type='hidden' name='currency_code' value='GBP'>
<input type='hidden' name='lc' value='GB'>
<input type='hidden' name='return' value='http://www.biosboss.com/checkout?confirm=Confirm&confirmTerms=on'>
<input type='hidden' name='cancel_return' value='http://www.biosboss.com/checkout'>
<input type='hidden' name='notify_url' value='http://www.biosboss.com/checkout?confirm=Confirm&confirmTerms=on'>
<input class='securePaymentButton' type='submit' value='here'>
<?php $checkout .= "</form>"; ?>
4

0 回答 0