I found that Chang Sau Sheong’s ruby-paypal library can use Mass Payment (http://ruby-paypal.rubyforge.org/) to automatically send money to any PayPal recipient. What’s confusing is that the RDoc on the site is from an older version that did not support Mass Payment.
Some older (2006) threads mention they want this, but they were never resolved. I hope this information will be useful to people that still don’t have the answer to this.
== Unofficial guide to sending automatic payments with Ruby
- gem install ruby-paypal
- require ‘ruby-paypal’ at the top of your file
- Use this example code for a single transaction or create your own:
Credentials found in environment files.
pp_nvp = PaypalNVP.new(PPG_API_USERNAME, PPG_API_PASSWORD, PPG_API_SIGNATURE) # def do_mass_payment(payments, email_subject, receiver_type='EmailAddress', currency_code='USD') payments =  payments = PayPalPayment.new payments.email = self.email payments.unique_id = 1239829 payments.note = "Note" payments.amount = Money.new(self.current_value) # Make the call. response = pp_nvp.do_mass_payment(payments, "Email subject line") # Update our own administration. if response.ack == 'Success' # Do success stuff here end
I could not get the ruby-paypal and the paypal (by Tobias Luetke) gem to work on the same Rails installation - they both use a class called Paypal. I fixed this by including ruby-paypal in my vendor/ dir and renaming the class Paypal to PaypalNVP. The Money library is included with the ‘paypal’ (NOT the ruby-paypal) gem.