How to integrate Paypal with Ruby on Rails

后端 未结 3 1750
说谎
说谎 2020-12-12 16:42

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 info

3条回答
  •  温柔的废话
    2020-12-12 17:10

    Standard PayPal Integration with Rails app Active Merchant gem

    Step 1

    • Add gem 'activemerchant' in your Gemfile

    • Run bundle install

    Step 2

    • 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.

    Step 3

    • 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
      

    Step 4

    • From here onward follow Rails Cast episode 145 (http://railscasts.com/episodes/145-integrating-active-merchant).

提交回复
热议问题