Skip to content
Paypal NVP API Class
Ruby
Latest commit 8a905fe Apr 19, 2016 Olivier Bonnaure New version 0.2.9
Failed to load latest commit information.
lib Use default open timeout value. Apr 15, 2016
.gitignore Initial import Mar 31, 2009
LICENSE Added MIT License Jul 28, 2011
README.rdoc Tweaking PaypalNVP#new in README. Apr 19, 2016
Rakefile New version 0.2.9 Apr 19, 2016
init.rb adding init.rb Mar 31, 2009
paypal_nvp.gemspec New version 0.2.9 Apr 19, 2016

README.rdoc

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"
  open_timeout: 3
  read_timeout: 60

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

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",
  :open_timeout => 3,
  :read_timeout => 60,
})

data = {
  :version => "50.0", # Default is 50.0 as well... but now you can specify it
  :method => "MyPaypalMethod",
  :amt => "55"
  # other params needed
}
result = p.call_paypal(data) # will return a hash
puts result["ACK"] # Success

PAYPAL API Documentation

cms.paypal.com/us/cgi-bin/?cmd=_render-content&content_ID=developer/howto_api_reference

Something went wrong with that request. Please try again.