Welcome to Working With Rails

 

Discussion Forums

Discuss all things Ruby on Rails with perhaps the web's most vibrant group of Ruby on Rails enthusiasts.
PayPal Integration in Ruby on Rails Application.
9 Posts
PayPal Integration in Ruby on Rails Application.

I want to implement Paypal Express Checkout in my application. i want to take the Credit Details from the User wants the amount he entered to be transfered in my Paypal Business account.

I have created paypal test accounts for the same.

But When I try to execute I get an Failure Message..

Fail: This API do not have any permission to make any transaction Details.

Plz help me with this..

Waiting for the Suggestion...

Its difficult to answer without seeing the code but Maybe you used some operation that not accessible in test account. Other possible problem - you should be athenticated before recieving transaction details

Did you check that ?

Piyush you may need to get to "paypal developer link":https://developer.paypal.com/ sign in with your sandbox account and go to the API Access link and provide API access to your business API account this will give you an API username/password and API signature. Use all this information in your ruby code and it should work. I suggest using Active Merchant for the API integration to ensure simplified integration.

Also I would check out *"ActiveMerchant":http://www.activemerchant.org/* - I've used it in the past and makes integration a lot easier.

I am using active_mechant here...What I am trying to do here is that I want to transfer the amount from the Credit card to my Tst account of Paypal. (which I created at developer.paypal.com).

I am also using the following details Paypal gave me during the registration. They are as follows:

Test Account: locala_1205224404_biz-xxxx.com
API Username: locala_1205224404_biz_api1.-xxxxl.com API Password: 12052-xxxx Signature: Apuh47QmzBz6ZPU-Dlp8p4uNNWGaAYdk9DE5pKun-uPM0s-o.yP3JmOV

class OrderController < ApplicationController require 'money' def checkout

end

def pay

amount_to_charge = Money.ca_dollar(1000) #ten US dollars
creditcard = ActiveMerchant::Billing::CreditCard.new(
# :number => '4477621376048889 ', #Authorize.net test card, error-producing
 :number => '4007000000027', #Authorize.net test card, non-error-producing
  :month => 3,                #for test cards, use any date in the future
  :year => 2018,              
  :first_name => 'Flinn',      
  :last_name => 'Muller',
  :type => 'visa'             #note that MasterCard is 'master'
)

if creditcard.valid?

    #gateway = ActiveMerchant::Billing::PaypalGateway.new(
    #:login => 'piyush_1201254206_biz@gmail.com',         #API Login ID
    #:password => '201254191') #Transaction Key


    gateway = ActiveMerchant::Billing::PaypalGateway.new(
   :login => '  locala_1205224404_biz_api1.xxxx.com',         #API Login ID
   :password => '12052-xxxx', #Transaction Key
   :signature => 'Apuh47QmzBz6ZPU-Dlp8p4uNNWGaAYdk9DE5pKun-uPM0s-o.yP3JmOV '
   )


  options = {
    :address => {},
    :billing_address => { 
      :name     => 'Flinn',
      :address1 => '1 Show Me The Money Lane',
      :city     => 'San Francisco',
      :state    => 'CA',
      :country  => 'US',
      :zip      => '23456',
      :phone    => '(555)555-5555'
    }
  }

  response = gateway.authorize(amount_to_charge, creditcard, :ip=>"127.0.0.1")

  if response.success?
    gateway.capture(amount_to_charge, response.authorization)
    @result = "Success: " + response.message.to_s
  else
    @result = "Fail: " + response.message.to_s
  end
else
  @result = "Credit card not valid: " + creditcard.validate.to_s
end

end

end

As far as I remember Express checkout integration will require the user to move from the cart directly to paypal , fill in his billing address and then return to merchant to authorize payment. There is no credit card transaction involved in the process. Please do check the implementation guide available within developer.paypal.com

Actually this is what I want to do in My application..

1) Suppose User buys any porduct from our site.(Worth $ 40)

2) On the Check out page he will provide us his shipping Address and Credit Card Details

The WebSite owner will have an Paypal Account and whatever amount customs pay here will be transfered to his paypal account.

3) We will take his credit cards details and will give those details to paypal site (using Active Merchant) and the amount will be transfered to Website owners paypal account.

4) In this case will not be redirect to paypal site nor it is compulsary for user to have an paypal account. He has to only have a credit card with him.

Also no issues related to Shipping address wil rise as the Web site admin will take care of it as Customer is providing his Shipping address during the final chackout..

Let me know if this is possible or not..Becoz I m a newbie who is working with rails... I may be wrong here...

9 Posts
Login to add your message