doujiacai4986 2013-03-03 11:41
浏览 43
已采纳

将项目总计添加到PayPal的订单摘要中,以进行完整的总计购物车付款

I've got my own shopping cart and everything set up, I just need a "Pay Now" button for my website users, and I just intend to send the entire cart's total amount up to payPal, that's it, no other integration necessary. So the customers on my website have already reviewed their order, checked quantities and shipping charges etc for individual items, and now PayPal just needs to be given the total amount which they will confirm and pay.

My code for the "Pay Now" button is below ($overall_total has already been calculated somewhere above in my php code):

<form action="https://www.paypal.com/cgi-bin/webscr" method="post">
   <input type="hidden" name="cmd" value="_s-xclick">
   <input type="hidden" name="hosted_button_id" value="JRECLRTYAJDKY">
   <input type="hidden" name="amount" value="<?php echo $overall_total;?>">
   <input type="hidden" name="item_total" value="<?php echo $overall_total;?>">
   <input type="hidden" name="item_name" value="Your Shopping order">
   <input type="image" src="https://www.paypalobjects.com/en_US/i/btn/btn_paynow_SM.gif" border="0" name="submit" alt="PayPal - The safer, easier way to pay online!">
   <img alt="" border="0" src="https://www.paypalobjects.com/en_US/i/scr/pixel.gif" width="1" height="1">
</form>

The user submits this form when they hit "Pay Now", and they come to next page. But Even though I included the amount and item_total variables, the next page gives me an item_total of 0.00. Also, I don't want any Quantity or Item price to show since I am simply implementing an aggregate cart payment for customers, and they have already reviewed per item charges before coming to the payment. This is what I get: enter image description here

How can I get rid of Quantity and Item price, and have the $overall_total value that I calculated inside the total price on the PayPal summary?

  • 写回答

2条回答 默认 最新

  • douyue1481 2013-03-03 13:03
    关注

    there is no item_total or any total, since every single button handles ONE item at once

    $overall_total must be in the english format with "." as decimals separator

    problem may be the cmd parameter.. use instead:

    <input type="hidden" name="cmd" value="_xclick">
    

    also you need to specify:

    <input type="hidden" name="business" value="yourBusiness@yourBusiness.tld">
    

    look at this for a more complete example:

    <form action="https://www.paypal.com/cgi-bin/webscr" method="post">
    
        <input type="hidden" name="cmd" value="_xclick">
        <input type="hidden" name="business" value="yourBusiness@yourBusiness.tld">
    
        <input type="hidden" name="lc" value="US">
        <input type="hidden" name="amount" value="10.10">
        <input type="hidden" name="currency_code" value="USD">
    
        <input type="hidden" name="item_name" value="Item bought desc">
    
        <input type="hidden" name="button_subtype" value="services">
        <input type="hidden" name="no_note" value="0">
    
        <input type="hidden" name="bn" value="PP-BuyNowBF:btn_paynow_SM.gif:NonHostedGuest">
        <input type="image" src="https://www.paypalobjects.com/en_US/i/btn/btn_paynow_SM.gif" border="0" name="submit" alt="PayPal - The safer, easier way to pay online!">
        <img alt="" border="0" src="https://www.paypalobjects.com/en_US/i/scr/pixel.gif" width="1" height="1">
    
    </form>
    

    also have a look at:


    about the "quantity" issue, sadly you can't hide it... if this is an important issue for you, you could try instead the ExpressCheckout (using php) which is very customizable and not that difficult to implement

    hoping to be helpful

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥15 素材场景中光线烘焙后灯光失效
  • ¥15 请教一下各位,为什么我这个没有实现模拟点击
  • ¥15 执行 virtuoso 命令后,界面没有,cadence 启动不起来
  • ¥50 comfyui下连接animatediff节点生成视频质量非常差的原因
  • ¥20 有关区间dp的问题求解
  • ¥15 多电路系统共用电源的串扰问题
  • ¥15 slam rangenet++配置
  • ¥15 有没有研究水声通信方面的帮我改俩matlab代码
  • ¥15 ubuntu子系统密码忘记
  • ¥15 保护模式-系统加载-段寄存器