【问题标题】:What kind of protocol is being used here to communicate with PayPal?这里使用什么样的协议与 PayPal 通信?
【发布时间】:2010-12-25 12:10:04
【问题描述】:

我知道有多种方法可以使用 PayPal 的 API(SOAP 等),但我对它们一无所知,所以为了扩大我对该主题的了解,请您告诉我是什么本示例中使用的是 railscasts:

   1. def paypal_url(return_url)  
   2.     values = {  
   3.       :business => ’seller_1234111143_biz@asciicasts.com’,  
   4.       :cmd => ’_cart’,  
   5.       :upload => 1,  
   6.       :return => return_url,  
   7.       :invoice => id  
   8.     }  
   9.       
   10.     line_items.each_with_index do |item, index|  
   11.       values.merge!({  
   12.         "amount_#{index + 1}" => item.unit_price,  
   13.         "item_name_#{index + 1}" => item.product.name,  
   14.         "item_number_#{index + 1}" => item.product.identifier,  
   15.         "quantity_#{index + 1}" => item.quantity  
   16.       })  
   17.     end  
   18.     "https://www.sandbox.paypal.com/cgi-bin/webscr?" + values.map { |k,v|     "#{k}=#{v}"  }.join("&")  
   19.   end  

谢谢!

【问题讨论】:

    标签: ruby-on-rails e-commerce paypal


    【解决方案1】:

    Http 是互联网协议

    【讨论】:

    • 实际上 HTTP 是万维网协议(因此称为“超文本”)。 Internet 协议是 TCP/IP。
    【解决方案2】:

    这是一个简单的 HTTP 获取请求。最终请求类似于:

    https://www.sandbox.paypal.com/cgi-bin/webscr?business=seller_1234111143_biz@asciicasts.com&cmd=_cart&upload=1...

    等等,应该有点眼熟。

    【讨论】:

      【解决方案3】:

      如前所述,这是对 PayPal 服务器的获取请求。

      具体来说,它是一个购物车上传命令 - 您可以在此处阅读:https://www.x.com/community/ppx/wps。如果有兴趣,请查看该页面右侧的 html 变量参考。正是那些通过提供的代码发送到 PayPal 的变量。

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2013-11-15
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多