gpt4 book ai didi

php - 将变量从篮子传递到 Paypal 以进行付款 - 增值税费用

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

我有自己的购物篮,显然是根据用户的购买情况建立起来的。一旦用户点击结账,这就会被传递到 Paypal 结账。这一切都成功,项目信息显示在左侧的 PayPal 购物车收据中。

但是,我对增值税费用有疑问。我已经为我的购物篮计算了增值税费用 (20%)(在我的网站内),但我不确定如何将这笔费用转嫁给 Paypal。目前,Paypal 只是通过根据数量添加项目价格来计算总数。有什么想法可以让增值税费用包含在 Paypal 中吗?

这是我的代码:

$product1 = mysql_fetch_assoc($sql1);?>
<input type='hidden' name='item_number_<?php echo $count; ?>' value="<?php echo $count; ?>">
<input type="hidden" name="item_name_<?php echo $count; ?>" value="<?php echo $product1['prod_name']; ?>">
<input type="hidden" name="amount_<?php echo $count; ?>" value="<?php echo $product1['price']; ?>">
<input type='hidden' name='quantity_<?php echo $count; ?>' value="<?php echo $item['quantity']?>">
<?php $count++; } ?>

这是我购物篮的运输代码:

$grand_total = isset($grand_total) ? $grand_total : 0;
$line_cost = $product['price'] * $item['quantity'];
$grand_total += $line_cost;
$charge = $grand_total /100 * 20;
$chargeincvat = $charge + $grand_total;

<tr><td colspan='6' align='right'>Charges (VAT 20%): &pound; <?=number_format($chargeincvat, 2);?></td></tr>

添加:

<form action="https://www.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="derrysnurseries@hotmail.co.uk">



<input type='hidden' name='item_number_1' value="1">

<input type="hidden" name="item_name_1" value="Moment in Time">

<input type="hidden" name="amount_1" value="6.95">

<input type='hidden' name='quantity_1' value="1">

<input type='hidden' name='tax_cart' value="8.34">

最佳答案

您可以使用以下作为表单元素的 name 属性:

shipping - applies to first item added to cart
shipping2 - applies to each additional item added to cart
handling_cart - applied once to cart regardless of quantity

例如

<input type="hidden" name="handling_cart" value="15.00">

应用 15.00 总运费

要向项目添加税/增值税,请使用 tax_#,其中 # 是项目编号,例如

<input type="hidden" name="tax_2" value=".15">

这会将 .15p 添加到项目编号 2。要添加购物车税/增值税使用

<input type="hidden" name="tax_cart" value=".15">

See page 263 of this doc并查看同一文档的第 294 页以自动计算税费/增值税费用

关于php - 将变量从篮子传递到 Paypal 以进行付款 - 增值税费用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10140612/

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