【问题标题】:Passing variables over from basket to Paypal for Payment - VAT charge将变量从篮子传递到 Paypal 以进行付款 - 增值税费用
【发布时间】:2012-04-25 19:18:49
【问题描述】:

我有自己的购物篮,它是根据用户明显购买的东西建立起来的。一旦用户点击结帐,这就会被传递到贝宝结帐。项目信息显示在左侧的 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">

【问题讨论】:

    标签: php paypal shopping-cart


    【解决方案1】:

    您可以将以下内容用作表单元素的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 页以自动计算税金/增值税成本

    【讨论】:

    • @user1278496 没有问题...查看我的更新 :-) 如果您搜索税而不是增值税,您会更开心...增值税仅限英国
    • 嘿伙计 - 它有点工作,除了贝宝已经计算了总额的增值税并将其添加(这很好)但随后它添加了总额。 EG - 总额为 171.95 英镑,其中 20% 为 34.39 英镑 - 将这些加在一起得到 206.34 英镑,但除此之外再加上 171.95(总计)......
    • @user1278496 我觉得总数是给你算的……你也是通过了吗?
    • 不,我没有通过总数。总数是计算出来的,但只在我的网站内
    • @user1278496 奇怪...您可以将表单的 HTML 输出添加到问题中吗?可能很明显 ....
    【解决方案2】:

    您可以尝试在

    中发送运输信息

    输入类型='hidden' name='shipping' value="25.93"

    你也可以在这里查看: https://cms.paypal.com/us/cgi-bin/?cmd=_render-content&content_ID=developer/e_howto_html_IPNandPDTVariables

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2014-06-15
      • 1970-01-01
      • 2011-05-08
      • 2013-10-19
      • 2015-05-01
      • 2012-02-09
      • 2019-12-13
      • 2015-08-18
      相关资源
      最近更新 更多