I am writing a Rails application and I understand that gateway objects are created with Activemerchant via the merchant's information. Usually, we would initialise the object via:
# development.rb
config.after_initialize do
ActiveMerchant::Billing::Base.mode = :test
paypal_options = {
login: [email protected],
password: password123456here,
signature: awesomeSignatureHere
}
::EXPRESS_GATEWAY = ActiveMerchant::Billing::PaypalExpressGateway.new(paypal_options)
Now I have two merchants on my application and I would want to have payments being credited to their paypal accounts directly without going through me. What would be the recommended steps in the event the user choose to pay Vendor A via the form at the view level, the constant of EXPRESS_GATEWAY would be switched to the appropriate merchant provided I have the merchants' information for their API stored in the database?
Thank you for your time.