我正在尝试创建一个结账为我的第三方购物车与贝宝。我把所有的价值完全相同的贝宝的网页"https://developer.paypal.com/docs/classic/paypal-payments-standard/integration-guide/cart_upload/“。
我从我的数据库中获取产品名称。问题是,它需要它第一次,但当我添加另一个产品到我的购物车,并点击购买去贝宝商店页面,它只有一个项目,我的数据库。我放了3个项目来测试它。
有人能帮帮我吗?我的代码是:
<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="vendedortest@test.com" />
<input type="hidden" name="item_name_1" value="<?php echo $product; ?>" />
<input type="hidden" name="item_number_1" value="<?php echo $id; ?>" />
<input type="hidden" name="amount_1" value="<?php echo $price; ?>" />
<input type="hidden" name="quantity_1" value="<?php echo $qty; ?>" />
<input type="hidden" name="currency_code" value="USD" />
<input type="hidden" name="lc" value="US" />
<input type="hidden" name="rm" value="2" />
<input type="hidden" name="return" value="products.php" />
<input type="hidden" name="cancel_return" value="cart.php" />
<input type="hidden" name="notify_url" value="paypal.php" />
<input type="hidden" name="charset" value="utf-8" />
</form>发布于 2015-05-08 23:43:47
我认为你混淆了两种不同的PayPal接口方法/产品,贝宝购物车( PayPal Shopping Cart,https://developer.paypal.com/docs/classic/paypal-payments-standard/integration-guide/paypal_shopping_cart/)和贝宝的第三方购物车功能(你在问题中链接到了它)。
PayPal购物车要求PayPal为您管理购物车,多个“添加到购物车”调用将在PayPal逐步构建一个商品购物车,然后您可以通过一个结帐呼叫作为一个组付款。您可以将cmd=_cart与“添加”或“查看”功能相结合,以修改或查看贝宝网站上的购物车,从该贝宝托管的页面,买家可以启动结账。
第三方结帐功能假定您的站点上有一个购物车,并且您正在管理从该购物车中添加和删除物品;在这种情况下,仅当客户有一个已完成的购物车并想要结帐时,才调用PayPal。在这个模型中,只有最后一次PayPal表单提交是相关的--它覆盖了之前的任何调用(这将被认为是中止支付)。这是经过设计的:用户可能会考虑购买3件东西,但返回到您的网站,决定添加或删除一些商品,然后决定购买更改后的购物车。以这种方式使用时,PayPal不会在多次调用_cart命令之间为您维护任何状态。这种用法是通过使用"upload“输入和_cart命令来控制的,正如您上面所做的那样。
如果你想把一些东西放在贝宝的购物车里,然后把更多的东西放在购物车里,然后对所有的东西进行结账,你需要切换到PayPal购物车,这意味着不使用“上传”,而是使用“添加”命令(加上文档中指出的一些其他更改)。
https://stackoverflow.com/questions/30091185
复制相似问题