How integrate Paypal Payment with Ruby on Rails -


i use gem integrate paypal ruby paypal ruby sdk goes perfect, can redirect users paypal sandbox account , user can confirm payment.

once user confirm payment redirect site paymentid, token , payerid in url.

the problem when want execute payment code

payment = payment.find(@payment.id)  if payment.execute( :payer_id => params[:payerid] )   # success message   # note you'll need `payment.find` payment again access user info shipping address else   payment.error # error hash end 

nothing happens.

standard paypal integration rails app active merchant gem :

step 1:

-> add 'gem activemerchant' in  gem file

-> bundle install

step 2:

-> go "www.developer.paypal.com" , create account(also known merchant account) address details.

-> create 2 dummy test account buyer , seller(alias facilitator) in "sandbox.paypal.com".

  ex: 
     seller account  --->  naveengoud-facilitator@gmail.com
     buyer account  --->  naveengoud-buyer@gmail.com
      
-> see test accounts details click on "dashboard -> accounts"

-> set password both test accounts clicking on profile link

step 3:

-> go seller account(i.e, facilitator) profile details , copy api credentials i.e, username, password , signature

  ex:
    username:  naveengoud-facilitator_api1.gamil.com
    password:   vspalj5ala5yy9yj
    signature:   avlslxw5ugzepadpek4oril7xo4iayjdwhd25hhs8a8kqpyo4fjfhd6a

-> set these api credentials in "config/environments/development.rb" follows, add below code api credentials

  config.after_initialize   activemerchant::billing::base.mode = :test                  ::gateway = activemerchant::billing::paypalgateway.new(                login: "merchant_api1.gotealeaf.com",               password: "2pwpeukzxaye7zhr",               signature: "afcwxv21c7fd0v3byyyrcpssrl31a-dri5vpyf4a9emruhnyzlm8poc0"           )        end 

step 4:

-> form here onwards follow rails cast 145 episode

paypal express checkout integration rails app activemerchant gem :

step 1:

-> add 'gem activemerchant' in  gem file

-> bundle install

step 2:

-> go "www.developer.paypal.com" , create account(also known merchant account) address details.

-> create 2 dummy test account buyer , seller(alias facilitator) in "sandbox.paypal.com".

  ex: 
     seller account  --->  naveengoud-facilitator@gmail.com
     buyer account  --->  naveengoud-buyer@gmail.com

      
-> see test accounts details click on "dashboard -> accounts"

-> set password both test accounts clicking on profile link

step 3:

-> go seller account(i.e, facilitator) profile details , copy api credentials i.e, username, password , signature

  ex:
    username:  naveengoud-facilitator_api1.gamil.com
    password:   vspalj5ala5yy9yj
    signature:   avlslxw5ugzepadpek4oril7xo4iayjdwhd25hhs8a8kqpyo4fjfhd6a

-> set these api credentials in "config/environments/development.rb" follows, add below code api credentials

  config.after_initialize   activemerchant::billing::base.mode = :test                  ::gateway = activemerchant::billing::paypalexpressgateway.new(                login: "merchant_api1.gotealeaf.com",               password: "2pwpeukzxaye7zhr",               signature: "afcwxv21c7fd0v3byyyrcpssrl31a-dri5vpyf4a9emruhnyzlm8poc0"           )        end 

step 4:

-> form here onwards follow rails cast 146 episode show less

-> check weather transaction successful or not, go 'sandbox.paypal.com'  login seller account , click on "all activity"  then can see payments


Comments

Popular posts from this blog

powershell Start-Process exit code -1073741502 when used with Credential from a windows service environment -

twig - Using Twigbridge in a Laravel 5.1 Package -

c# - LINQ join Entities from HashSet's, Join vs Dictionary vs HashSet performance -