Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Integrating Payment Gateway (activemerchant based) with spree

I am trying to integrate payu.in payment gateway into my rails app. I have integrated their gem in the application but when i go to

/admin/payment_methods/new

I am not able to see the payment gateway under the provider options.

I have followed the steps as prescribed in http://guides.spreecommerce.com/payment_gateways.html

My app/models/spree/gateway/payu.rb looks like this:

module Spree
  class Gateway::Payu < Gateway
    def provider_class
      ActiveMerchant::Billing::Integrations::PayuIn
    end
  end
end
like image 602
phoenixwizard Avatar asked Nov 04 '12 20:11

phoenixwizard


2 Answers

I believe you need something like this:

config.after_initialize do |app|
  app.config.spree.payment_methods += [
    Spree::BillingIntegration::PaypalExpress,
    Spree::BillingIntegration::PaypalExpressUk
  ]
end

(See: https://github.com/spree/spree_paypal_express/blob/master/lib/spree_paypal_express/engine.rb#L23-28 )

like image 156
GeekOnCoffee Avatar answered Oct 24 '22 06:10

GeekOnCoffee


For me it just worked when I added a similar line of code:

config.after_initialize do
  Rails.configuration.spree.payment_methods << Spree::PaymentMethod::Pagarme
end

To my config/application.rb file.

(I saw it in http://blog.siyelo.com/active-merchant-and-spree)

like image 36
Rodrigo Gomes Avatar answered Oct 24 '22 06:10

Rodrigo Gomes