I am building an app that needs to take money from a customer wh开发者_运维百科o is paying by credit card and deposit that money into another customer's bank account. I don't want to store the bank account info, I just want to say "deposit X dollars into user Y's bank account" where Y calls a 3rd party. The app is in rails. Any clean solutions out there?
You will have to have the Y's bank routing number and bank account number if you want to directly deposit funds into Y's account.
First you will need to setup Active Merchant in your rails app. Use the plugin or gem:
rails plugin install git://github.com/Shopify/active_merchant.git
gem 'activemerchant'
After you got that installed on your app you will need to sign up with a gateway. Heres a full list of supported gateways https://github.com/Shopify/active_merchant/wiki/gatewayfeaturematrix
These railscasts will get help get you started on Active Merchant:
http://railscasts.com/episodes/144-active-merchant-basics
http://railscasts.com/episodes/145-integrating-active-merchant
To use a bank instead of a credit card, create a new method in the Order model if you are following the railscast
def bank_account
@bank_account ||= ActiveMerchant::Billing::Check.new(
:account_holder_type=> "personal",
:account_number=> "number",
:account_type => "checking/savings",
:name=> "name",
:routing_number=> "routing_number")
end
end
First choose a third party to handle your transactions. And then use their API to do it. For example if you choose PayPal you can use these gems (I have not used them myself, so do check on them before you come to a decision on what to use):
- http://ruby-paypal.rubyforge.org/
- http://www.paypalobjects.com/en_US/ebook/PP_NVPAPI_DeveloperGuide/Appx-SDKRuby.html
精彩评论