I can not make a purchase via activemerchantif my currency is not 'USD' Here's error text message from response.message: The transaction currency specified must be the same as previously specified.

Here's purchase setup:

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
)

And here's purchase itself:

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

Maybe I should specify currency in express_purchase_options also?

有帮助吗?

解决方案 2

Yes, the currency specified needs to be the same in all calls throughout the flow. It looks like this must be using Express Checkout..?? You just need to make sure the SetExpressCheckout request and the DoExpressCheckoutPayment request are using the same currency code.

其他提示

I'm using this gem in one of my projects with 'EUR' currency.

My configuration is as follows:

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

And that's it. No need to configure anything else.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top