Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/url/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ruby on rails 这里使用什么样的协议与PayPal通信?_Ruby On Rails_E Commerce_Paypal - Fatal编程技术网

Ruby on rails 这里使用什么样的协议与PayPal通信?

Ruby on rails 这里使用什么样的协议与PayPal通信?,ruby-on-rails,e-commerce,paypal,Ruby On Rails,E Commerce,Paypal,我知道使用PayPal的API(SOAP等)有多种方法,但我对它们一无所知,因此,为了拓宽我在这方面的知识面,请告诉我railscasts在本例中使用了什么: 1. def paypal_url(return_url) 2. values = { 3. :business => ’seller_1234111143_biz@asciicasts.com’, 4. :cmd => ’_cart’, 5.

我知道使用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  

谢谢大家!

Http是Internet协议

这是一个通过Http的简单get请求。最后的请求类似于:

cmd=\u购物车和上传=1


诸如此类,看起来应该有些熟悉。

如前所述,这是对PayPal服务器的get请求


具体来说,这是一个购物车上载命令-您可以在此处阅读:。如果感兴趣,请查看该页面右侧的html变量参考。正是这些变量与提供的代码一起发送到PayPal。

实际上HTTP是万维网协议(因此称为“超文本”)。互联网协议是TCP/IP。