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.
Step 1: Create a plan using the PayPal API. Step 2: Update the last product in the database paypal_plan_name with the returned plan.id . Step 3: Add routes for PayPal subscription. Step 4: Handle create and execution in the PayPal service.
Standard PayPal integration This method allows you to add PayPal to all of your product pages and to your checkout process in 3 steps: Open the admin panel for your checkout on your shop or ecommerce platform. Select standard PayPal payments as a payment option. Add the access information for your PayPal account.
It utilizes Flutter Webview, to complete the payment process... "It's a Simple Spell But Quite Unbreakable".
-> 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)
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:
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With