gpt4 book ai didi

PHP Paypal 动态传递多个项目

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

我正在尝试添加多个产品以便在 paypal 上进行处理。订单 summery 未显示任何项目。我正在 paypal 沙盒上尝试。

完整代码如下:

    <form action="https://www.sandbox.paypal.com/cgi-bin/webscr" method="post" id="paypal">

<input type="hidden" name="cmd" value="_xclick" />
<input type="hidden" name="upload" value="1">
<input type="hidden" name="cbt" value="Return to max shop" />
<input type="hidden" name="business" value="example@gmail.com">

<?php
if(isset($_SESSION['products']))
{
$obj=new project;
$i=1;
foreach($_SESSION['products'] as $product)
{
$sql=$obj->get_products($product['id']);
$row=mysql_fetch_array($sql);
?>
<input type="hidden" name="item_number_<?php echo $i ?>" value="<?php echo $i ?>">
<input type="hidden" name="item_name_<?php echo $i ?>" value="<?php echo $row['title'] ?>" />

<input type="hidden" name="amount_<?php echo $i ?>" value="<?php echo $row['cost'] ?>">
<input type="hidden" name="item_quantity_<?php echo $i ?>" value="<?php echo $product['qty'] ?>">

<?php
$i++;
}
}
?>


<input type="hidden" name="button_subtype" value="services" />
<input type="hidden" name="no_shipping" value="1" />
<input type="hidden" name="return" value="http://localhost/oops" />

<input type="hidden" name="currency_code" value="USD"/>

<input type="hidden" id="custom" name="custom" value="invoice_id to track"/>
<input type="hidden" class="btn btn-primary" style="width:100%" alt="PayPal - The safer, easier way to pay online!"/>
<input type="image" src="http://www.paypalobjects.com/en_US/i/btn/x-click-but23.gif" border="0" name="submit" width="68" height="23" alt="Make payments with PayPal - it's fast, free and secure!">
</form>

我也尝试了如下的数组格式,但没有收到任何结果;

    <input type="hidden" name="item_number[<?php echo $i ?>]" value="<?php echo $i ?>">
<input type="hidden" name="item_name[<?php echo $i ?>]" value="<?php echo $row['title'] ?>" />
<input type="hidden" name="amount[<?php echo $i ?>]" value="<?php echo $row['cost'] ?>">
<input type="hidden" name="item_quantity[<?php echo $i ?>]" value="<?php echo $product['qty'] ?>">

最佳答案

上传命令仅适用于 _cart 而不适用于 _xclick

将此行更改为:

 <input type="hidden" name="cmd" value="_cart" />

<form action="https://www.sandbox.paypal.com/cgi-bin/webscr" method="post" id="paypal">

<input type="hidden" name="cmd" value="_cart" />
<input type="hidden" name="upload" value="1">
<input type="hidden" name="cbt" value="Return to max shop" />
<input type="hidden" name="business" value="XXX-facilitator@gmail.com">

<?php
$_SESSION['products'] =2;
$product ='';
$pro =array("red","green");
if(isset($_SESSION['products']))
{
// $obj=new project;
$i=1;
foreach($pro as $key)
{
//$sql=$obj->get_products($product['id']);
$row='row';
?>
<input type="hidden" name="item_number_<?php echo $i ?>" value="<?php echo $i ?>">
<input type="hidden" name="item_name_<?php echo $i ?>" value="title" />

<input type="hidden" name="amount_<?php echo $i ?>" value="10.00">
<input type="hidden" name="item_quantity_<?php echo $i ?>" value="product">

<?php
$i++;
}
}
?>


<input type="hidden" name="button_subtype" value="services" />
<input type="hidden" name="no_shipping" value="1" />
<input type="hidden" name="return" value="http://localhost/oops" />

<input type="hidden" name="currency_code" value="USD"/>

<input type="hidden" id="custom" name="custom" value="invoice_id to track"/>
<input type="hidden" class="btn btn-primary" style="width:100%" alt="PayPal - The safer, easier way to pay online!"/>
<input type="image" src="http://www.paypalobjects.com/en_US/i/btn/x-click-but23.gif" border="0" name="submit" width="68" height="23" alt="Make payments with PayPal - it's fast, free and secure!">
</form>

关于PHP Paypal 动态传递多个项目,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23630411/

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