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 为什么使用javacv转封装rtsp为rtmp时出现如下问题:[h264 @ 000000004faf7500]no frame?
  • ¥15 乘性高斯噪声在深度学习网络中的应用
  • ¥15 运筹学排序问题中的在线排序
  • ¥15 关于docker部署flink集成hadoop的yarn,请教个问题 flink启动yarn-session.sh连不上hadoop,这个整了好几天一直不行,求帮忙看一下怎么解决
  • ¥30 求一段fortran代码用IVF编译运行的结果
  • ¥15 深度学习根据CNN网络模型,搭建BP模型并训练MNIST数据集
  • ¥15 C++ 头文件/宏冲突问题解决
  • ¥15 用comsol模拟大气湍流通过底部加热(温度不同)的腔体
  • ¥50 安卓adb backup备份子用户应用数据失败
  • ¥20 有人能用聚类分析帮我分析一下文本内容嘛