Search code examples
ruby-on-railsrubyactiverecordactivemerchant

Difficult to use ActiveMerchant in a project that does not use ActiveRecord as its ORM?


ActiveMerchant seems to be baked with AR in mind.

I've come to this conclusion based on the fact that the purchase() method returns an ActiveRecord::Billing::Response object:

Is this correct and, if so, does this mean it might be difficult to use ActiveMerchant in a project that uses a different Ruby ORM (Sequel/Datamapper)?


Solution

  • If you check the implementation of ActiveMerchant::Billing::Response, there is no mention of ActiveRecord anywhere in the file. Not sure where you got the idea that AM returns AR objects.

    Looking at the implementation of #purchase for the Braintree gateway, it calls #commit, which simply returns an ActiveMerchant::Billing::Response object