I've watched Ryan Bate's rails casts on PayPal integration. I've even gotten it to work with a Rails 3.1 test app and PayPal's sandbox.
However, the approach highlighted in the rails cast is more for end-users paying YOU 开发者_如何学Python(your business). What if you need to to send money to your customers? Is there a tutorial / video / documentation on how to go about this?
Ideally, I would like to use my Paypal account to send money to a customer's bank account which in some cases may not necessarily be Paypal owned.
The correct approach for sending user's money is to use the PayPal payout API. In order to do this you'll need a (validated) set of emails. Then the following API docs supply some information on the calls required:
https://developer.paypal.com/docs/integration/direct/create-single-payout/ https://developer.paypal.com/docs/integration/direct/create-batch-payout/
PayPal provides a Ruby gem (https://github.com/paypal/PayPal-Ruby-SDK/) for doing this integration. The even include a few a sample snippet to show how to integrate:
https://github.com/paypal/PayPal-Ruby-SDK/tree/master/samples/payouts
Once I was in the same situation but I couldn't figure it out either. The only thing that came to my mind is to store the important information for further transactions and then set up a cronjob with a script which transfers the money from your account to the thrid party.
Example: 'CustomerA' wants to buy from 'CustomerB' through you 'SiteOperator'
CustomerA pruchases a fake article from SiteOperator
You store information about the amount to forward to CustomerB (calculate fees, etc)
Cronjob loops every 15min and calls PayPal API to send money to CustomerB.
That's how I would do it.
精彩评论