将支付网关(基于activemerchant)与spree集成

时间:2012-11-04 20:32:30

标签: ruby-on-rails ruby-on-rails-3.2 payment-gateway spree

我正在尝试将payu.in支付网关集成到我的rails应用程序中。 我已经在应用程序中集成了他们的gem,但是当我去

  

/ admin / payment_methods / new

我无法在提供商选项下看到付款网关。

我已遵循http://guides.spreecommerce.com/payment_gateways.html

中规定的步骤

我的app / models / spree / gateway / payu.rb如下所示:

module Spree
  class Gateway::Payu < Gateway
    def provider_class
      ActiveMerchant::Billing::Integrations::PayuIn
    end
  end
end

2 个答案:

答案 0 :(得分:4)

我相信你需要这样的东西:

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

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

答案 1 :(得分:1)

对我而言,当我添加类似代码时,它才起作用:

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

到我的config / application.rb文件。

(我在http://blog.siyelo.com/active-merchant-and-spree中看到了)