PayPal Ruby on Rails Integration

I saw messages that you should use ActiveMerchant to integrate PayPal, but I also found this on the PayPal website. I am struggling with placing in which file, since I am completely unfamiliar with RoR. So I tried to integrate PayPal , but I don’t know where to place this code.

Should I use an active merchant to integrate PayPal, or the best option for the Rest-API. I want people to fill out their username, pay, and if successful receive digital content. Thus, there should be a call with the result and username.

You have a link, step by step, at least including the code that I have to put in which file, so I better understand the basics of RoR.

+6
source share
4 answers

I found the PayPal API documentation quite confusing. Also, my APIs were not satisfied with the API, so I got a pretty simple solution.

The solution consists mainly of two components:

  • The PayPal buttons that I create on the PayPal website and copy the HTML to my website.
  • PayPal IPN notifications for which I have a simple handler on my website.

Thus, the whole solution works in detail

  • In order for the user to be able to make payments, I use the PayPal buttons. To do this, you simply log into your PayPal account and generate the HTML code for the buttons that you can copy and paste into your website.
  • The user can click on these buttons, they will be redirected to the PayPal website, they will make payments and you will have a button to return to your website.
  • When the transaction is completed (successful or unsuccessful), PayPal will notify you via PayPal IPN notifications. I implemented an IPN handler on my website, which was pretty easy to do.
  • By the time the user returns to my site, in most cases I would have already received an IPN notification, so I can show them a successful message.
  • If the IPN is delayed, I will tell users that it will take another couple of minutes to update their balance and use AJAX to continue to request the server for updates.

Here are some useful links:

+7
source

Standard PayPal integration with Rails. Active Store:

step 1:

-> add 'gem activemerchant' to the gem file

-> install package

step 2:

-> Go to the page "www.developer.paypal.com" and create an account (also known as a Merchant Account) with information about the address in the USA.

-> He will create two dummy test accounts for the buyer and seller (alias assistant) in "sandbox.paypal.com".

Example:
Seller Account ---> naveengoud-facilitator@gmail.com
Buyer Account ---> naveengoud-buyer@gmail.com

-> To view information about test accounts Click "Dashboard β†’ Accounts"

-> Now set a password for both accounts by clicking on the profile link

Step 3:

-> Go to the seller’s profile page (for example, a facilitator) and copy the API credentials ie, username, password and signature

Example:
Username: naveengoud-facilitator_api1.gamil.com
Password: VSPALJ5ALA5YY9YJ
Signature: AVLslxW5UGzEpaDPEK4Oril7Xo4IAYjdWHD25HhS8a8kqPYO4FjFhd6A

-> Set these API credentials in "config / environment / development.rb" as follows: add the code below with the 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 

step 4:

-> Next, follow the episode of Rails cast 145 ( http://railscasts.com/episodes/145-integrating-active-merchant )

+5
source

This link will help you better understand the integration of Basic Checkout, credit cards, and re-payments with PayPal in Ruby On Rails.

http://www.gotealeaf.com/blog/basic-paypal-checkout-processing-in-rails

You can find solutions for the following concepts,

1) Basic check 2) Credit cards 3) Periodic payments

+4
source

Look at this for rails integration:

but here, in general (less related to Rails):

0
source

Source: https://habr.com/ru/post/953815/


All Articles