Skip to content

Latest commit

 

History

History
39 lines (29 loc) · 1.25 KB

README.rdoc

File metadata and controls

39 lines (29 loc) · 1.25 KB

Paypal NVP

Paypal NVP allow to connect your Ruby on Rails application to the Paypal NVP API.

Installation

The recommended way is that you get the gem:

$ sudo gem install paypal_nvp

PaypalNVP need an optional paypal.yml file in your config directory (Rails App). Or you can specify parameter within the constructor

# All those fields are mandatory

sandbox:
  url:  "https://api-3t.sandbox.paypal.com/nvp"
  user: "o.bonn_1237393081_biz_api1.solisoft.net"
  pass: "1237393093"
  cert:  "AU2Yv5COwWPCfeYLv34Z766F-gfNAzX6LaQE6VZkHMRq35Gmite-bMXu"

live:
  url:  "https://api-3t.paypal.com/nvp"
  user: "o.bonn_1237393081_biz_api1.solisoft.net"
  pass: "1237393093"
  cert:  "AU2Yv5COwWPCfeYLv34Z766F-gfNAzX6LaQE6VZkHMRq35Gmite-bMXu"

Example usage

p = PaypalNVP.new(true) # true mean "use sandbox"
# Or you can specify paramaters directly
# p = PaypalNVP.new(true, { :user => "o.bonn_1237393081_biz_api1.solisoft.net", :pass => "1237393093", :cert => "AU2Yv5COwWPCfeYLv34Z766F-gfNAzX6LaQE6VZkHMRq35Gmite-bMXu", :url => "https://api-3t.sandbox.paypal.com/nvp" })
data = {
  :method => "MyPaypalMethod",
  :amt => "55"
  # other params needed
}
result = p.call_paypal(data) # will return a hash
puts result["ACK"] # Success