【发布时间】:2011-12-08 10:01:46
【问题描述】:
我正在尝试学习如何集成 paypal 以进行购物结账。我创建了一个带有自定义购物车的网站。现在我在看了这个http://www.youtube.com/watch?v=qDbTqeSUrQY&feature=relmfu之后添加了paypal集成代码
它有效,但唯一的问题是当我使用沙盒或真实账户从买家的角度尝试时,我无法使用信用卡,即我需要贝宝账户才能执行。我不知道是否需要更改代码或更改贝宝中的设置。我试过浏览他们的文件,没有提及,它说我可以接受信用卡和普通账户的付款,但是如何?
我使用的代码
<form action="https://www.sandbox.paypal.com/cgi-bin/webscr" method="post">
<input type="hidden" name="cmd" value="_cart">
<input type="hidden" name="upload" value="1">
<input type="hidden" name="business" value="abhishek.salian.85@gmail.com">
<?php if($_SESSION['cart']) { $total = 0;$i=0;
foreach($_SESSION['cart'] as $product_id => $quantity) {
$product_details = get_product_details($product_id);
$row_cost = $product_details[product_price] * $quantity;
$total = $total + $row_cost; $x=$i+1; ?>
<input type="hidden" name="item_name_<?php echo $x; ?>" value="<?php echo $product_details[product_title]; ?>">
<input type="hidden" name="quantity_<?php echo $x; ?>" value="<?php echo $_SESSION['cart'][product_id]; ?>">
<input type="hidden" name="amount_<?php echo $x; ?>" value="<?php echo $product_details[product_price]; ?>">
<?php $product_id_array = $product_details[product_id]."-".$_SESSION['cart'][product_id].",";$i++; } } ?>
<input type="hidden" name="custom" value="<?php echo $product_id_array; ?>">
<input type="hidden" name="notify_url" value="<?php echo WEBSITE.'paypal/ipn.php'; ?>">
<input type="hidden" name="return" value="<?php echo WEBSITE.'products/thank_you'; ?>">
<input type="hidden" name="rm" value="2">
<input type="hidden" name="cbt" value="Retun to Flash Shop">
<input type="hidden" name="cancel_return" value="<?php echo WEBSITE.'products/cancel'; ?>">
<input type="hidden" name="lc" value="AU">
<input type="hidden" name="currency_code" value="AUD">
<input type="image" src="http://www.paypal.com/en_US/i/btn/x-click-but01.gif" name="submit" alt="Make payments with PayPal - it's fast, free and secure!"></form>
【问题讨论】: