【问题标题】:paypal mode of payment in codeignitercodeigniter中的paypal支付方式
【发布时间】:2017-03-11 01:28:39
【问题描述】:

我已在 codeigniter 控制器中将以下数据发布到我的 paypal 函数中

**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
)**

我需要将我的总计和所需数据重定向到贝宝官方链接

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

我需要发布什么..?

请指导进一步的程序

【问题讨论】:

    标签: php codeigniter paypal


    【解决方案1】:

    需要这样的 HTML 表单:

    例如你的数组是$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 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>
    

    详情https://developer.paypal.com/docs/classic/paypal-payments-standard/integration-guide/formbasics/

    【讨论】:

    • 最后一封电子邮件将是用户的电子邮件 ID?我在沙盒环境中验证
    • name="business" 这是贝宝电子邮件 ID,name="email" 是客户电子邮件 ID
    • okz 退货时我需要将我的产品详细信息和订单详细信息保存到数据库我将如何知道交易是否成功???
    • name="notify_url" 通知网址。从贝宝成功/失败后,您会获得一些 post 数据。如果付款状态为成功,那么您将在通知 url 页面上的数据库中插入一些代码。
    • 您正在登录卖家的帐户进行此次购买。请更改您的登录信息,然后重试。为我的买家帐户收到此错误,为什么会有这样的想法?
    猜你喜欢
    • 2014-07-29
    • 2021-08-04
    • 2013-02-15
    • 2017-01-04
    • 2020-10-30
    • 2015-03-29
    • 1970-01-01
    • 2014-01-23
    • 2015-04-18
    相关资源
    最近更新 更多