Project

paypal_nvp

0.03
Repository is archived
No commit activity in last 3 years
No release in over 3 years
Paypal NVP API Class.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
 Dependencies
 Project Readme

Paypal NVP¶ ↑

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

Installation¶ ↑

You can install the gem in one of two ways. The first is using the gem install command from the command line:

$ gem install paypal_nvp

And the second is using Bundler. Simply add ‘gem ’paypal_nvp’‘ to your gemfile, then install with the following command:

$ bundle install

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