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.
How to allow different from USD currency in activemerchant gem?
-
18-06-2023 - |
Вопрос
I can not make a purchase
via activemerchant
if 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
Другие советы
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.
Не связан с StackOverflow