我知道有多种方法可以使用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
谢谢!
答案 0 :(得分:1)
如上所述,这是对PayPal服务器的获取请求。
具体来说,它是购物车上传命令 - 您可以在此处阅读:https://www.x.com/community/ppx/wps。如果有兴趣,请查看该页面右侧的html变量参考。这些变量是通过提供的代码发送给PayPal的。
答案 1 :(得分:0)
这是一个基于HTTP的简单get请求。最终的请求看起来像是:
https://www.sandbox.paypal.com/cgi-bin/webscr?business=seller_1234111143_biz@asciicasts.com& cmd = _cart& upload = 1 ...
等等,看起来应该有些熟悉。
答案 2 :(得分:-2)
Http是互联网协议