2009-12-11 72 views
1

我知道有各種方法可以使用PayPal的API(SOAP等),但我對它們一無所知,所以爲了擴大我對這個主題的知識,請告訴我使用什麼在這個例子中來自railscasts:這裏使用什麼樣的協議與PayPal進行通信?

1. def paypal_url(return_url) 
    2.  values = { 
    3.  :business => ’[email protected]’, 
    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 

謝謝!

回答

1

如前所述,這是一個GET請求到PayPal的服務器。

具體它是一個購物車的上傳命令 - 你可以看到這個位置:https://www.x.com/community/ppx/wps。如果感興趣,請查看該頁面右側的html變量引用。這些變量是通過提供的代碼發送給PayPal的。

-2

HTTP是互聯網協議

+0

實際上HTTP是萬維網協議(因此稱爲「超文本」)。 Internet協議是TCP/IP。 – 2009-12-11 10:31:50