forked from ritchiey/paypal_adaptive_gateway
-
Notifications
You must be signed in to change notification settings - Fork 0
lathavairamani/paypal_adaptive_gateway
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
Paypal Adaptive Payments Library for ActiveMerchant Supports payments, preapprovals, refunds and currency conversions Requirements: .Rails 3.0 .Json .Builder .ActiveMerchant 1.9.x to install git clone https://github.com/varsh/paypal_adaptive_gateway.git or download from https://github.com/varsh/paypal_adaptive_gateway cd <path to root of downloaded patch> rails <Path to active merchant library> ex: "C:\Ruby187\lib\ruby\gems\1.8\gems\activemerchant-1.9.1" to use in application_controller.rb def gateway @gateway ||= PaypalAdaptivePaymentGateway.new( :login => 'your_email', :password => 'your_password', :signature => ' your_signature', :appid => 'your_app_id' ) end In the payment process: #for chained payments def checkout recipients = [{:email => 'receiver_email', :amount => some_amount, :primary => true}, {:email => 'receiver_email', :amount => recipient_amount, :primary => false} ] response = gateway.pay( :return_url => url_for(:action => 'action', :only_path => false), :cancel_url => url_for(:action => 'action', :only_path => false), :notify_url => url_for(:action => 'notify_action', :only_path => false), :receiver_list => recipients ) redirect_to response.redirect_url_for end set the :primary flag to false for each recipient for a split payment In the Refund process: recipients = [{:email => params[:receiveremail_0], :amount => params[:amount_0]} ] response = gateway.refund( :return_url => "returnURL", :cancel_url => "cancelURL", :pay_key=>params[:paykey], :receiver_list => recipients ) In the preapproval process: response = gateway.preapprove_payment( :return_url => "returnURL", :cancel_url => "cancelURL", :senderEmail =>"email address of sender", :start_date =>"starting date", :end_date =>"ending date", :currency_code =>"currency code", :max_amount =>"maxTotalAmountOfAllPayments", :maxNumberOfPayments =>"maxNumberOfPayments" ) In the cancel preapproval process: response = gateway.cancel_preapproval( :preapproval_key =>"preapprovalkey" ) to debug use either gateway.debug or response.debug this gives you the json response, the xml sent and the url it was posted to.
About
Paypal adaptive payments for activemerchant
Resources
Stars
Watchers
Forks
Releases
No releases published
Packages 0
No packages published
Languages
- Ruby 100.0%