Module: Paypal::Masspay

Includes:
HTTParty
Defined in:
lib/paypal/masspay.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.masspay(payer_email, receiver_email, amount, currency, note, unique_id) ⇒ Object



5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
# File 'lib/paypal/masspay.rb', line 5

def self.masspay(payer_email, receiver_email, amount, currency, note, unique_id)
  request_uri = URI.parse(Paypal.nvp_uri)
  request_uri.scheme = "https" # force https

  body = {
    "METHOD" => "MassPay",
    "VERSION" => "2.3",
    "CURRENCYCODE" => currency,
    "SUBJECT" => payer_email,
    "USER" => Paypal.api_username,
    "PWD" => Paypal.api_password,
    "SIGNATURE" => Paypal.api_signature,
    "RECEIVERTYPE" => "EmailAddress",
    "L_EMAIL0" => receiver_email,
    "L_AMT0" => amount,
    "L_UNIQUEID0" => unique_id,
    "L_NOTE0" => note
  }
  self.post(request_uri.to_s, :body => body).body
end

Instance Method Details

#successful_payment?Boolean

Returns:

  • (Boolean)


26
27
28
# File 'lib/paypal/masspay.rb', line 26

def successful_payment?
  payment_response["ACK"] == "Success"
end