1

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.

1 Answer 1

1

I have solved this by creating a method in the necessary model and creating instance variable for it.

2
  • Could you check which user did receive the payment? Because having multiple accounts. Without save this extra information I think it's not accesible.
    – joseglego
    Commented Aug 21, 2018 at 18:45
  • @joseglego thanks for responding! I believe at that point of time, the payment routing was through user prior to the merchants. Anyway, it has been solved :) thanks again!
    – Bryan Wong
    Commented Aug 22, 2018 at 23:15

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.