Coder Social home page Coder Social logo

jpablobr / active_paypal_adaptive_payment Goto Github PK

View Code? Open in Web Editor NEW
86.0 86.0 45.0 376 KB

PayPal Adaptive Payments for Active Merchant

Home Page: http://rubydoc.info/github/jpablobr/active_paypal_adaptive_payment/master/frames

License: MIT License

Ruby 75.42% JavaScript 24.58%

active_paypal_adaptive_payment's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

active_paypal_adaptive_payment's Issues

Authentication failed

I've tried with 3 different users, but with all of them Paypal returns me an auth erros. Here's the relevant parts of my env:

ruby -v
ruby 1.9.3p0 (2011-10-30 revision 33570) [x86_64-darwin10.8.0]

Gemfile
gem 'rails', '3.2.3'
gem 'activemerchant', '1.17.0', require: 'active_merchant'
gem 'active_paypal_adaptive_payment', '~> 0.3.13'

Debug (I've added headers to the debug method, and added the IP address also):

Url: https://svcs.sandbox.paypal.com/AdaptivePayments/Pay

Headers: {"X-PAYPAL-REQUEST-DATA-FORMAT"=>"XML", "X-PAYPAL-RESPONSE-DATA-FORMAT"=>"JSON", "X-PAYPAL-SECURITY-USERID"=>"****", "X-PAYPAL-SECURITY-PASSWORD"=>"**", "X-PAYPAL-SECURITY-SIGNATURE"=>"***", "X-PAYPAL-APPLICATION-ID"=>"APP-80W284485P519543T", "X-PAYPAL-DEVICE-IPADDRESS"=>"127.0.0.1"}

Request:

ReturnAll en_US PAY http://localhost:3000/pt/paypal/8/cancel http://localhost:3000/pt/paypal/8/success currencyCode:BRL/ [email protected] 55.0 true false

Response: {"responseEnvelope":{"timestamp":"2012-05-25T10:33:38.824-07:00","ack":"Failure","correlationId":"6fd3fcb2e9390","build":"2945555"},"error":[{"errorId":"520003","domain":"PLATFORM","subdomain":"Application","severity":"Error","category":"Application","message":"Authentication failed. API credentials are incorrect."}]}"

Hashie gem conflict

I'm not sure how to best fix this, or even figure out what gem dependency is causing this.

My issue is that I have active_paypal_adaptive_payment setup and in use, and am now adding amniauth-facebook to my app. In doing so I ran into a version conflict with the Hashie gem.

`
Bundler could not find compatible versions for gem "hashie":
In Gemfile:
active_paypal_adaptive_payment (>= 0) ruby depends on
hashie (~> 1.0.0) ruby

omniauth-facebook (>= 0) ruby depends on
  hashie (1.2.0)

`

Chained payments not working?

I am trying to use chained payments, but I am noticing that the secondary receiver is being charged fees as if this was a split payment. How to solve?

[{:email => "seller@******.com",
  :amount => 100,
  :primary => true
 },
 {
  :email => "feeReceiver@*****.com",
  :amount => 3,
  :primary => false
 }]

Embedded payment not working?

Hi

I have been using this gem for the past year and its great but for no reason today the sandbox is not accessible and crashes with the following error:

Proxy Error

The proxy server could not handle the request GET /webapps/adaptivepayment/flow/pay.
Reason: Error during SSL Handshake with remote server

is this an issue with the gem or sandbox endpoint?

How to send a single payment to a single user?

Hi.

We're using Active Merchant. We want to send a payment to a single user using PayPal Adaptive Payment. I installed this gem.

Once I have the gateway object, what method should I call to do this?
And how do I pass the following parameters:

  • email address of the recipient
  • amount in cents
  • currency code

Are there any other parameters I should be aware of?

Thanks

Adaptive Payment Refund functionality Issue The refund's Error receiver [email protected] wasn't part of the payment

Please Help Me in this issue .
I am sending request Like This In adaptive delayed chained payment for refund functionality

requestEnvelope.errorLanguage=en_US&requestEnvelope.detailLevel=ReturnAll&payKey=AP-0W669522L6576684X&CURRENCYCODE=GBP&TRANSACTIONID=4DA43013G4561763W&requestEnvelope.errorLanguage=en_US¤cyCode=GBP&receiverList.receiver(0)[email protected]&receiverList.receiver(0).accountId=AGH52GTL74KZY&receiverList.receiver(0).amount=19.02&receiverList.receiver(0).primary=false&REFUNDTYPE=Partial

And I am getting the Error Like

Array ( [responseEnvelope.timestamp] => 2017-03-15T06:58:40.702-07:00 [responseEnvelope.ack] => Failure [responseEnvelope.correlationId] => f264d1c531eef [responseEnvelope.build] => 30801389 [error(0).errorId] => 589037 [error(0).domain] => PLATFORM [error(0).subdomain] => Application [error(0).severity] => Error [error(0).category] => Application [error(0).message] => The refund's receiver [email protected] wasn't part of the payment request [error(0).parameter(0)] => [email protected] )

413 error while authenticating with omniauth-twitter when this gem is in the bundle

I've set up a repo to make it easier to reproduce the error: https://github.com/diogob/demo_paypal_omniauth
Steps to reproduce the bug:

  1. Clone the repo and setup the rails app (bundle, db:create and all that jazz)
  2. Edit the config/initializers/omniauth.rb and insert a valid key and secret to an oauth twitter application
  3. Start the server using thin: rails s thin (have not tested with webrick)
  4. Access the address: http://localhost:3000/auth/twitter
  5. It should respond with:
    OAuth::Unauthorized
    413 Request Entity Too Large

If you just comment out the active_paypal_adaptive_payment from the Gemfile, reinstall the bundle and restart the server, the twitter auth works as expected (and leads to a non-existent SessionController).

BTW, the error does not depend on the presence of the gem activemerchant in the Gemfile.
I would guess that it has something to do with the file active_paypal_adaptive_payment / lib / active_merchant / billing / gateways / paypal_adaptive_payments / ext.rb

Strange indeed!

Best Regards

Not receiving a response from the IPN when ipn_notification_url is called

I wasn't able to retrieve the information sfrom the IPN for the confirmations after the payment. Can you provide a guideline for that or a link that can help me figuring it out?

Also, I've implemented "Setting advanced payment and invoice options" and I'm not sure where exactly the invoice is going? It seem that the information provided there are used to set up the paypal landing page for the item being purchased.

https://gist.github.com/8acceeee72fe12312c09

Chained payments not working

In a chained payment, using the same example in "README.md" but setting both recipients to ":primary => false" does work.
However setting one to "true" and the other to "false" prompts a paypal web page saying " This transaction is not valid. Go back the the vendor website and try again"

This transaction is invalid. Please return to the recipient's website and try again.

setup_purchase method does works fine for me with my data api, but preapprove_payment method does not works.

This is my controller:

def pay
 gateway =  ActiveMerchant::Billing::PaypalAdaptivePayment.new(
  :login => "email",
  :password => "pass",
  :signature => "signature",
  :appid => "APP-80W284485P519543T" )
  response = gateway.preapprove_payment( 
  :return_url => user_orders_url(current_user),
  :cancel_url => user_orders_url(current_user),
  :sender_email =>"email",
  :start_date => Time.now,
  :end_date => Time.now,
  :currency_code =>"USD",
  :max_amount => "20",
  :maxNumberOfPayments => "2")
 puts response.preapproval_key
 puts gateway.debug
  # for redirecting the customer to the actual paypal site to finish the payment.
  redirect_to (gateway.redirect_url_for(response["preapproval_key"]))
end

I get in log:

PA-8K9332086D720151L
{:url=>#<URI::HTTPS:0xdf9bd18 URL:https://svcs.sandbox.paypal.com/AdaptivePayments/Preapproval>, :request=>"<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<PreapprovalRequest>\n  <requestEnvelope>\n    <detailLevel>ReturnAll</detailLevel>\n    <errorLanguage>en_US</errorLanguage>\n    <senderEmail>email</senderEmail>\n  </requestEnvelope>\n  <endingDate>2012-07-20T19:09:20</endingDate>\n  <startingDate>2012-07-20T19:09:20</startingDate>\n  <maxTotalAmountOfAllPayments>20</maxTotalAmountOfAllPayments>\n  <maxNumberOfPayments>2</maxNumberOfPayments>\n  <currencyCode>USD</currencyCode>\n  <cancelUrl>http://localhost:3000/en/u/maserranocaceres/orders</cancelUrl>\n  <returnUrl>http://localhost:3000/en/u/maserranocaceres/orders</returnUrl>\n</PreapprovalRequest>\n", :response=>"{\"responseEnvelope\":{\"timestamp\":\"2012-07-20T10:09:22.459-07:00\",\"ack\":\"Success\",\"correlationId\":\"ada6a3e7da93d\",\"build\":\"DEV\"},\"preapprovalKey\":\"PA-8K9332086D720151L\"}"}

What am I doing wrong?

Setting the item description for the Payee

I think I must be missing something obvious, but I can't figure out how to change the text that PayPal displays for the item description when people come to pay, in the "Payment Summary" section.

It just displays the name of the primary account.

I'm building a site that let people make payments to other members, from which we take a small cut.

Setting the descriptions for the invoices works a treat, with each user seeing the correct thing, except for the actual payee, who just sees "Joe Smith's Test Store" (the sandbox test account's name).

I've looked in the docs for ActiveMerchant and Adaptive Payments but I just can't work out where the correct place to do this is. Some help would be very much appreciated. The code I'm using is below.

payment = payment_gateway.setup_purchase(
  :action_type => "CREATE",
  :return_url => completed_credit_path(@credit.uuid, :only_path => false),
  :cancel_url => failed_credit_path(@credit.uuid, :only_path => false),
  :currency_code => 'GBP',
  :memo => "Payment - #{@credit.event.name}",
  :receiver_list => recipients
)

payment_gateway.set_payment_options(
  :display_options => {
    :business_name    => "My Business"
  },
  :pay_key => payment["payKey"],
  :receiver_options => [
    {
      :receiver => { :email =>  ENV['PAYPAL_ACCOUNT'] },
      :invoice_data => {
        :item => [
          { 
            :name => "Payment - #{@credit.event.name}",
            :description => "Payment - #{@credit.event.name}",
            :item_count => 1,
            :item_price => @credit.full_price,
            :price => @credit.full_price
          }
        ]
      }
    },
    {
      :receiver => { :email => @credit.organiser.email },
      :invoice_data => {
        :item => [
          { 
            :name => "Payment - #{@credit.event.name} (After Fees)",
            :description => "Payment - #{@credit.event.name} (After Fees)",
            :item_count => 1,
            :item_price => @credit.take_home,
            :price => @credit.take_home
          }
        ]
      }
    }
  ]
)

redirect_to (payment_gateway.redirect_url_for(payment["payKey"]))

What parameters does paypal send back when it redirects to my site?

How do I verify that the transaction was successful? Or do I just have to rely on whichever callback url it redirects to to know whether it was successful or not?

I am doing chained payments and it is redirecting back to my site using the return_url. Is it trying to send something to my ipn url?

App ID

Hello all. I'm using this gem and it wasn't working initially because it required an app ID but PayPal didn't give me one. I changed line 37 of active_paypal_adaptive_payment.rb to not require an app ID and since then things have been gravy. I realize it's a tiny change but I've forked a copy of the repo and will send a pull request shortly!

How to authorize preapproval keys

So, I've been able to use the preapprove_payment method to get a preapproval key, but the sender has to authorize it before I can use it to capture funds (I assume through execute_payment). Other ActiveMerchant gateways have a redirect_url_for([token]) method that I can use to get the paypal url where the sender can approve payment. Is there a similar method for this adaptive gateway?

I've created a stack overflow question for this problem here.

Refund method NO_API_ACCESS_TO_RECEIVER

I can not make a refund, I get the next message in response log:

...refund_status="NO_API_ACCESS_TO_RECEIVER">]> response_envelope=#<Hashie::Rash ack="Success"....

Its possible fix this error?

Thank you so much!

#setup_purchase response payKey redirects user to wrong url

When calling #setup_purchase the response payKey redirects user to redirect_url_for(response["payKey"].to_s) url which seems to be incorrect since that's the pay screen, and if the user submits the form, immediate payment is made.

It appears that the users need to be sent to /webscr?cmd=_ap-preapproval&preapprovalkey=PA-XXX which in turn will prompt the user with the proper pre-approval form.

Can't start server

Ruby 1.9.2p180
Rails 3.1.1

In my gemfile gem 'active_paypal_adaptive_payment' followed by bundle install. Then rails s, and

c:/Ruby192/lib/ruby/gems/1.9.1/gems/activemerchant-1.5.1/lib/active_merchant/lib
/validateable.rb:31:in `<module:Validateable>': uninitialized constant ActiveMer
chant::Validateable::HashWithIndifferentAccess (NameError)
        from c:/Ruby192/lib/ruby/gems/1.9.1/gems/activemerchant-1.5.1/lib/active
_merchant/lib/validateable.rb:2:in `<module:ActiveMerchant>'
        from c:/Ruby192/lib/ruby/gems/1.9.1/gems/activemerchant-1.5.1/lib/active
_merchant/lib/validateable.rb:1:in `<top (required)>'
        from c:/Ruby192/lib/ruby/gems/1.9.1/gems/activemerchant-1.5.1/lib/active
_merchant.rb:33:in `require'
        from c:/Ruby192/lib/ruby/gems/1.9.1/gems/activemerchant-1.5.1/lib/active
_merchant.rb:33:in `<top (required)>'
        from c:/Ruby192/lib/ruby/gems/1.9.1/gems/active_paypal_adaptive_payment-
0.3.8/lib/active_paypal_adaptive_payment.rb:2:in `require'
        from c:/Ruby192/lib/ruby/gems/1.9.1/gems/active_paypal_adaptive_payment-
0.3.8/lib/active_paypal_adaptive_payment.rb:2:in `<top (required)>'
        from c:/Ruby192/lib/ruby/gems/1.9.1/gems/bundler-1.1.pre.4/lib/bundler/r
untime.rb:68:in `require'
        from c:/Ruby192/lib/ruby/gems/1.9.1/gems/bundler-1.1.pre.4/lib/bundler/r
untime.rb:68:in `block (2 levels) in require'
        from c:/Ruby192/lib/ruby/gems/1.9.1/gems/bundler-1.1.pre.4/lib/bundler/r
untime.rb:66:in `each'
        from c:/Ruby192/lib/ruby/gems/1.9.1/gems/bundler-1.1.pre.4/lib/bundler/r
untime.rb:66:in `block in require'
        from c:/Ruby192/lib/ruby/gems/1.9.1/gems/bundler-1.1.pre.4/lib/bundler/r
untime.rb:55:in `each'
        from c:/Ruby192/lib/ruby/gems/1.9.1/gems/bundler-1.1.pre.4/lib/bundler/r
untime.rb:55:in `require'
        from c:/Ruby192/lib/ruby/gems/1.9.1/gems/bundler-1.1.pre.4/lib/bundler.r
b:122:in `require'
        from c:/Users/vinceh/Desktop/projects/weeverails/config/application.rb:7
:in `<top (required)>'
        from c:/Ruby192/lib/ruby/gems/1.9.1/gems/railties-3.1.1/lib/rails/comman
ds.rb:52:in `require'
        from c:/Ruby192/lib/ruby/gems/1.9.1/gems/railties-3.1.1/lib/rails/comman
ds.rb:52:in `block in <top (required)>'
        from c:/Ruby192/lib/ruby/gems/1.9.1/gems/railties-3.1.1/lib/rails/comman
ds.rb:49:in `tap'
        from c:/Ruby192/lib/ruby/gems/1.9.1/gems/railties-3.1.1/lib/rails/comman
ds.rb:49:in `<top (required)>'
        from script/rails:6:in `require'
        from script/rails:6:in `<main>'

Seems to be coming from the require.

Unable to load active_merchant/common

When trying to load my project I get this exception:

no such file to load -- active_merchant/common

I am using:
rails 3.0.10
active_paypal_adaptive_payment 0.1.2

I tried the obvious step of adding a line in my gemfile:

gem "activemerchant", :require => 'active_merchant'

That did not solve the problem.

Set payments as "Family and friends"

Hey, I'm looking for a way to set a payment without charging any fees to any of the users involved in the transaction. I know I can set up a payment_type as PERSONAL and I believe this is the option I want. So I setup this option as well within the receiver_listkey but is not working. the fees are still being charging.
Do you know something about this?. thanks in advance.

Inconsistent naming of IPN keys

It's :notify_url for preapprovals and :ipn_notification_url for everything else. Also this difference is undocumented.

Cheers!

item description, support for Embedded flow?

With this code from yours documentation item description details will not shown on paypal side? So everything that user can see is generic text and order total price and nothing more. Do you have support for Embedded flow? In that way details will be visible.

payment is completed without the sender logging in to paypal.com

preapproval_payment feature is working fine and I have a preapproval_key inside my database.

Now I want execute the agreement with my preaproval_key.

I have been checking cancel_preapproval method and it does work fine.

I dont need go to paypal page with cancel_preapproval method in my cancel_order method in my order controller.i.e.:

preapproval_key = @order.payment.preapproval_key
 response = gateway.cancel_preapproval(:preapproval_key => preapproval_key)
   respond_to do |format|
      if response.ack == "Success"
       @order.update_attributes
           format.html { redirect_to user_orders_url(current_user), notice: t(".cancel_order_success") }
       else
           format.html { redirect_to user_orders_url(current_user), alert: t(".cancel_order_wrong") }
      end
    end

How can I execute the agreement with my preapproval_key for transfer funds from sender account to receiver account?

is it possible this feature for execute the agreement instead cancel the agreement with my preapproval_key?

Thank you very much

payKey issue

I'm trying to setup a payment using the following codes:

response = @gateway.setup_purchase(
          :return_url => url_for(:action => :done, :params => {:order => @order.number}),
          :cancel_url => url_for(:action => :cancel, :params => {:order => @order.number}),
          :ipn_notification_url => url_for(:action => :ipn, :params => {:order => @order.number}),
          :receiver_list => recipients
      )

then, i redirect user to paypal site using the following logic

if response[:payKey].present?
        redirect_to @gateway.redirect_url_for(response[:payKey])
else
        #something else to happen
end

I've seen response[:payKey] is nil sometime. That's why it is not redirecting to Paypal. Why response[:payKey] is missing and what should I do actually do to resolve this?

FYI: I'm trying to setup a Chained payments with primary recipient.

Thanks in advance.

Weird errors on Heroku

I am using this gem for one of my projects. I'm trying to deploy to Heroku, but the deploy fails with a strange error:

-----> Heroku receiving push
-----> Ruby/Rails app detected
-----> Installing dependencies using Bundler version 1.1.pre.10
Running: bundle install --without development:test --path vendor/bundle --deployment
Fetching dependency information from the API at http://rubygems.org/
Unfortunately, the gem active_paypal_adaptive_payment (0.2.0) has an invalid gemspec. As a result, Bundler cannot install this Gemfile. Please ask the gem author to yank the bad version to fix this issue. For more information, see http://bit.ly/illformed-requirement.
!
! Failed to install gems via Bundler.
!
! Heroku push rejected, failed to compile Ruby/rails app

To [email protected]:myapp.git
! [remote rejected] master -> master (pre-receive hook declined)
error: failed to push some refs to '[email protected]:myapp.git'

It might be that the 0.2.0 version of the gem causing rubygems to break.
Is there anyway to yank that version from rubygems?

How to send an implicit approval payment?

Hi.

Could you please include an example for the following (taken from PayPal Adaptive Payment doc)
in the gem document?

"Implicit approval payments, in which your application is both the sender of a payment and
the caller of the Adaptive Payments Pay API.
In this case, PayPal makes the payment from your own account, which eliminates the need
for approval."

Thanks
Zack

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.