title: Paypal Adaptive payments?
body: <p>I am using PayPal Adaptive Payments in a rails 3 application. I'm wondering if this the best approach or if there's better way to use PayPal Adaptive Payments?</p>
  
  <p>=> Install Active merchant plugin latest version </p>
  
  <pre><code>https://github.com/sijokg/active_merchant(https://github.com/sijokg/active_merchant.git) 
  </code></pre>
  
  <p>=> Create a Object for paypal adaptive gateway </p>
  
  <pre><code>    gateway = ActiveMerchant::Billing::PaypalAdaptivePaymentGateway.new( :login =&gt;        "divya_xxxxxx_biz_api1.yahoo.com",:password =&gt; "XXXXXXXX", :signature =&gt; "XXXXXXXXXXXXXXXXXXXX",:appl_id =&gt; "APP-80W284485P519543T" ) 
  
  
  
     ss= gateway.pay params[:donor][:amount].to_i , 'foobar@yahoo.com', :ip =&gt; request.remote_ip,   
       :sender_email =&gt; "foobar@yahoo.com",
       :tracking_id =&gt; tracking_id,
       :pay_key =&gt; '24',
       :return_url =&gt;"http://myapp.heroku.com,                                              :cancel_url=&gt;                
  </code></pre>
  
  <p>"http://foofoo.heroku.com ,
    :ipn_notification_url => "http://foofoo.heroku.com/paypal_ipn"</p>
  
  <p>=> It returns paykey , using this paykey I redirect to below urls based on requiremnet </p>
  
  <pre><code>    redirect_to "https://www.sandbox.paypal.com/webscr?cmd=_ap-payment&amp;paykey=#{ ss.params['pay_key']}" 
      redirect_to "https://www.paypal.com/webscr?cmd=_ap-payment&amp;paykey=#{ ss.params['pay_key']}"  
  </code></pre>
  
  <p>=> It goes to paypal site and compelte transaction with email or visa card and return .</p>
  
  <p>=> If I use sandbox account , It needs to login in sandbox account </p>
  
  <p>=> It send " Paypal Ipn " to my site .</p>
  
  <p>=> Tranaction complete .</p>
  
  <p><em>*</em>  This process takes much time because it is two steps process . If it is not correct,  pelase suggest any alternative solution with paypal adaptive payments .</p>