Cody Fauser does a great job of getting the PayPal transaction working with ActiveMerchant with RoR.
As soon as you start working in test mode, you just need to return the money. With activemerchant, they are called "transfers."
In the controller, just do something like below:
success = EXPRESS_GATEWAY.transfer(amount * 100, paypal_email_to_refund_to, :currency => currency.name, :subject => "Withdrawal from My Site", :note => "A personal message if you want")
scott source share