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 DS18B20内部ADC模数转换器
  • ¥15 做个有关计算的小程序
  • ¥15 MPI读取tif文件无法正常给各进程分配路径
  • ¥15 如何用MATLAB实现以下三个公式(有相互嵌套)
  • ¥30 关于#算法#的问题:运用EViews第九版本进行一系列计量经济学的时间数列数据回归分析预测问题 求各位帮我解答一下
  • ¥15 setInterval 页面闪烁,怎么解决
  • ¥15 如何让企业微信机器人实现消息汇总整合
  • ¥50 关于#ui#的问题:做yolov8的ui界面出现的问题
  • ¥15 如何用Python爬取各高校教师公开的教育和工作经历
  • ¥15 TLE9879QXA40 电机驱动