forked from ritchiey/paypal_adaptive_gateway
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathREADME
56 lines (42 loc) · 1.54 KB
/
README
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
Paypal Adaptive Payments Library for ActiveMerchant
Supports payments, preapprovals, refunds and currency conversions
Requirements:
.Rails 2.3.x
.Json
.Builder
.ActiveMerchant 1.5.x
to install
git clone git://github.com/lamp/paypal_adaptive_gateway.git
cd /path/to/paypal_adaptive_gateway
./script/install /path/to/active/merchant
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
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.