【问题标题】:How to allow different from USD currency in activemerchant gem?如何在 activemerchant gem 中允许与美元货币不同?
【发布时间】:2014-04-27 21:15:36
【问题描述】:

如果我的货币不是“美元”,我无法通过activemerchant创建purchase 这是来自response.message 的错误短信: The transaction currency specified must be the same as previously specified.

这是购买设置:

response = EXPRESS_GATEWAY.setup_purchase(product.price,       
      :currency          => product.currency.upcase, # it's 'EUR'
      :items             => [{name: product.name, quantity: 1, amount: product.price, description: product.description}],
      :ip                => request.remote_ip,
      :return_url        => paypal_checkout_url,
      :cancel_return_url => paypal_checkout_url
)

这是购买本身:

def purchase
  response = EXPRESS_GATEWAY.purchase(product.price, express_purchase_options)
end

def express_purchase_options
{
  :ip => ip_address,
  :token => express_token,
  :payer_id => express_payer_id
}
end

也许我也应该在express_purchase_options 中指定货币?

【问题讨论】:

    标签: paypal ruby-on-rails-4 paypal-sandbox activemerchant


    【解决方案1】:

    我在我的一个项目中使用此 gem 并使用“欧元”货币。

    我的配置如下:

    # config/application.rb
    config.after_initialize do
      ActiveMerchant::Billing::PaypalExpressGateway.default_currency = 'EUR'
    end
    

    就是这样。无需配置其他任何东西。

    【讨论】:

    • 并记得在此更改后重新加载 Rails 服务器。
    【解决方案2】:

    是的,在整个流程中的所有调用中,指定的货币都必须相同。看起来这必须使用 Express Checkout ..??您只需确保 SetExpressCheckout 请求和 DoExpressCheckoutPayment 请求使用相同的货币代码。

    【讨论】:

    • 是的,我正在使用 PayPal ExpressCheckout
    • 我也遇到同样的问题,我首先使用 AUD 请求 SetExpressCheckout,下次使用 AUDDoExpressCheckoutPayment 再次请求/b> 但收到此错误。
    • 需要查看您的请求样本以确认这一点。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2011-03-05
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多