dqj96395 2016-10-28 07:34
浏览 48
已采纳

codeigniter中的paypal付款方式

I had posted following data to my paypal function in codeigniter controller

**Array
(
    [firstname] => firstname
    [email_id] => root@abc.com
    [address] => abc phase
    [select_country] => 1
    [select_state] => 1
    [select_city] => 1
    [zipcode] => 233234
    [address_same] => 0
    [shipping_address] => 
    [select_country3] => Select
    [shipping_state] =>abc 
    [shipping_city] => abc
    [zipcode3] => 123456
    [user_id] => 41
    [shipping_charge] => 50
    [grand_total] => 13569
    [quantity] => 1
    [payment_mode] => 1
    [submit] => submit
)**

i need to redirect my grand total and required data to paypal official link

https://www.paypal.com/cgi-bin/webscr

what all i need to post ..?

please guide for further procedure

  • 写回答

1条回答 默认 最新

  • doufeixuan8882 2016-10-28 08:00
    关注

    Need to HTML form like this :

    Example your array is $myArray

    <?php
        $rand=rand();
    ?>
    <form id="paypal_<?php echo $rand;?>" action="https://www.paypal.com/cgi-bin/webscr" method="post">
      <input type="hidden" name="cmd" value="_cart">
      <input type="hidden" name="business" value="<?php echo $myArray['email_id']; ?>">
      <input type="hidden" name="item_name" value="hat">
      <input type="hidden" name="item_number" value="123">
      <input type="hidden" name="amount" value="15.00">
      <input type="hidden" name="first_name" value="<?php echo $myArray['firstname']; ?>">
      <input type="hidden" name="last_name" value="Doe">
      <input type="hidden" name="address1" value="9 Elm Street">
      <input type="hidden" name="address2" value="Apt 5">
      <input type="hidden" name="city" value="Berwyn">
      <input type="hidden" name="state" value="PA">
      <input type="hidden" name="zip" value="19312">
      <input type="hidden" name="email" value="jdoe@zyzzyu.com">
      <input type="hidden" name="notify_url" value="your_notify_url" />
      <input type="hidden" name="currency_code" value="EUR">
      <input type='hidden' name='return' value="your_return_url"/>
      <input type="image" name="submit"
        src="https://www.paypalobjects.com/en_US/i/btn/btn_buynow_LG.gif"
        alt="PayPal - The safer, easier way to pay online">
    </form>
    

    Script for auto submit

    <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script>
    <script>
    $(document).ready(function(){
        $("#paypal_<?php echo $rand;?>").submit();
    });
    </script>
    

    For details https://developer.paypal.com/docs/classic/paypal-payments-standard/integration-guide/formbasics/

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 WPF 大屏看板表格背景图片设置
  • ¥15 这个主板怎么能扩出一两个sata口
  • ¥15 不是,这到底错哪儿了😭
  • ¥15 2020长安杯与连接网探
  • ¥15 关于#matlab#的问题:在模糊控制器中选出线路信息,在simulink中根据线路信息生成速度时间目标曲线(初速度为20m/s,15秒后减为0的速度时间图像)我想问线路信息是什么
  • ¥15 banner广告展示设置多少时间不怎么会消耗用户价值
  • ¥16 mybatis的代理对象无法通过@Autowired装填
  • ¥15 可见光定位matlab仿真
  • ¥15 arduino 四自由度机械臂
  • ¥15 wordpress 产品图片 GIF 没法显示