<img src=“https://www.travis-ci.org/railslove/Will-Paypal.png?branch=master” alt=“Build Status” />
Will Paypal allow to connect your Ruby on Rails application to the Paypal NVP API. It’s based on the Paypal NVP Gem github.com/solisoft/paypal_nvp but completely rewritten.
The recommended way is that you get the gem:
$ sudo gem install will_paypal
Specify the API-Credentials within the constructor, add a logger. You can also use a ‘settings.yml’ to put everything there
# All those fields are mandatory sandbox: url: "https://api-3t.sandbox.paypal.com/nvp" (default) user: "o.bonn_1237393081_biz_api1.solisoft.net" password: "1237393093" signature: "AU2Yv5COwWPCfeYLv34Z766F-gfNAzX6LaQE6VZkHMRq35Gmite-bMXu" version: "72.0" (default) live: url: "https://api-3t.paypal.com/nvp" (default) user: "o.bonn_1237393081_biz_api1.solisoft.net" password: "1237393093" signature: "AU2Yv5COwWPCfeYLv34Z766F-gfNAzX6LaQE6VZkHMRq35Gmite-bMXu" version: "72.0" (default)
p = WillPaypal.new(:user => Settings.payment.paypal.merchant, :password => Settings.payment.paypal.pass, :sandbox => Settings.payment.paypal.sandbox, :signature => Settings.payment.paypal.cert, :version => "72.0", :logger => logger) data = { :method => "MyPaypalMethod", :amt => "55" # other params needed } result = p.call_paypal(data) # will return a hash puts result[:parsed_body]["ACK"] # Success The Result-Hash looks like that: :parsed_body=>{ "TIMESTAMP"=>"2011-05-19T00:25:19Z", "BUILD"=>"1882144", "VERSION"=>"72.0", "CORRELATIONID"=>"correlationid", "TOKEN"=>"mytoken", "ACK"=>"Success" }, :status=>"200", :body=>"TOKEN=mytoken&TIMESTAMP=2011%2d05%2d19T00%3a25%3a19Z&CORRELATIONID=correlationid&ACK=Success&VERSION=72%2e0&BUILD=1882144"
cms.paypal.com/us/cgi-bin/?cmd=_render-content&content_ID=developer/howto_api_reference