Reputation: 4081
I've seen posts that you should use ActiveMerchant for PayPal integration, but I also found this on the PayPal website.I'm struggling with placing what in which file, since I'm totally new to RoR. So I was trying to integrate the PayPal, but am not sure where to place which code.
Should I use active merchant for PayPal integration, or is the Rest-API the best choice. I want people to fill out their username, pay and when successful they receive digital content. So there should be a call with a result and the username.
Do you have a link, step by step, at least including which code I should place in which file, so I get the basics of RoR better.
Upvotes: 7
Views: 5837
Reputation: 814
-> add 'gem activemerchant' in gem file
-> bundle install
-> Go to "www.developer.paypal.com" and create an account(also known as Merchant Account) with US address details.
-> It will create two dummy test account for buyer and seller(alias facilitator) in "sandbox.paypal.com".
Ex:
Seller account ---> [email protected]
Buyer account ---> [email protected]
-> To see test accounts details Click on "Dashboard -> Accounts"
-> Now set the password for both test accounts by clicking on profile link
-> Go to seller account(i.e, facilitator) profile details and copy the API Credentials i.e, Username, password and signature
Ex:
Username: naveengoud-facilitator_api1.gamil.com
Password: VSPALJ5ALA5YY9YJ
Signature: AVLslxW5UGzEpaDPEK4Oril7Xo4IAYjdWHD25HhS8a8kqPYO4FjFhd6A
-> Set these API Credentials in "config/environments/development.rb" as follows, add the below code with API credentials
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
-> From here onward follow the Rails cast 145 episode(http://railscasts.com/episodes/145-integrating-active-merchant)
Upvotes: 8
Reputation: 814
This link will help you to get better understanding on integration of Basic Checkout, Charge Credit Cards and Recurring Payments with paypal in Ruby On Rails application
http://www.gotealeaf.com/blog/basic-paypal-checkout-processing-in-rails
You can find solutions for following concepts,
1) Basic Checkout 2) Charge Credit Cards 3) Recurring Payments
Upvotes: 6
Reputation: 12679
Look at this for rails integration:
but also here, more in general (less related to Rails):
Upvotes: 0
Reputation: 2125
I found the PayPal API documentation to be quite confusing. Also, my application requirements were not satisfied through the API, so I ended up with a rather simple solution.
The solution mainly consists of two components:
This is how the whole solution works in detail
Here are some useful references:
Upvotes: 7