gpt4 book ai didi

php - 在 Paypal 结账时显示所有购物车商品

转载 作者:太空宇宙 更新时间:2023-11-03 16:25:30 25 4
gpt4 key购买 nike

我想列出在 Paypal 结账时购买的所有商品。我尝试了以下代码,但它没有在那里显示项目。它只是在结帐时显示输入字段。我也在添加 paypal 的快照。我是第一次尝试将我的网站与 Paypal 集成。 enter image description here

代码

<form action="https://www.paypal.com/cgi-bin/webscr" method="post">
<!-- Identify your business so that you can collect the payments. -->
<input type="hidden" name="business" value="testaddabusiness@shop.com">
<!-- Specify a Buy Now button. -->
<input type="hidden" name="cmd" value="_xclick">
<?php
if(isset($_SESSION['cart'])){
foreach($_SESSION['cart'] as $id => $value){
$count=1;
?>
<input type="text" name="item_name_<?php echo $count ?>" value="<?php echo $value['name'] ?>">
<input type="text" name="item_qty_<?php echo $count ?>" value="<?php echo $value['quantity'] ?>">
<input type="text" name="amount_<?php echo $count ?>" value="<?php echo $value['price'] ?>">
<input type="text" name="color_<?php echo $count ?>" value="<?php echo $value['color'] ?>">
<input type="text" name="size_<?php echo $count ?>" value="<?php echo $value['size'] ?>">
<input type="text" name="currency_code_<?php echo $count ?>" value="USD">

<?php
$count++;
}}
?>
<!-- Display the payment button. -->
<input type="image" name="submit" border="0" src="https://www.paypalobjects.com/en_US/i/btn/btn_buynow_LG.gif" alt="PayPal - The safer, easier way to pay online">
<img alt="" border="0" width="1" height="1" src="https://www.paypalobjects.com/en_US/i/scr/pixel.gif" >
</form>

最佳答案

item_name_x仅适用于购物车上传命令。

您需要更改 cmd值为“_cart ”,并添加另一个名为 upload 的变量和 1 的值.

这是一个例子:

cmd = _cart
upload = 1
amount_1 = 0.01
item_name_1 = Test Item
item_number_1 = 123
currency_code = USD
...

在那之后,您的代码应该可以工作了。

欲了解更多信息,请访问 HTML Variables of PayPal Payment Standard .

关于php - 在 Paypal 结账时显示所有购物车商品,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34187476/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com