Im trying to integrate paypal with my ruby on rails application using the rest-api-sdk-ruby gem (https://github.com/paypal/rest-api-sdk-ruby), but could not find enough information around or a good tutorial to back me up. The description provided above, although providing the necessary code, does not show how to handle the methods around or in which files should each method go to.
Could anyone give me a starting point here or point me to a good tutorial?
I am using rails version 4.
Many thanks.
Add gem 'activemerchant'
in your Gemfile
Run bundle install
Go to "developer.paypal.com" and create an account (also known as Merchant Account) with US address details.
It will create two dummy test accounts, one each for the buyer and the seller (a.k.a. facilitator), in "sandbox.paypal.com". To see test accounts details Click on "Dashboard -> Accounts"
Now set the password for both test accounts by clicking on the profile link.
Go to seller account (i.e. facilitator) profile details and copy the API Credentials, i.e. username, password and signature. For example:
Username: naveengoud-facilitator_api1.gamil.com
Password: VSPALJ5ALA5YY9YJ
Signature: AVLslxW5UGzEpaDPEK4Oril7Xo4IAYjdWHD25HhS8a8kqPYO4FjFhd6A
Set these API Credentials in "config/environments/development.rb" as follows:
config.after_initialize do
ActiveMerchant::Billing::Base.mode = :test
::GATEWAY = ActiveMerchant::Billing::PaypalGateway.new(
login: "merchant_api1.gotealeaf.com",
password: "2PWPEUKZXAYE7ZHR",
signature: "AFcWxV21C7fd0v3bYYYRCpSSRl31A-dRI5VpyF4A9emruhNYzlM8poc0"
)
end