ruby-on-railsauthenticationfedex

Active_shipping Fedex API Authentication Error


I'm implementing aсtive_shipping plugin functionality in my app. I've got test account from fedex and trying to get some shipping rates as shown in plugin's readme at github:

fedex = FedEx.new(:login => '***', :password => '***', :key => '***', 
:account => '510087569', :meter => '100054531')
response = fedex.find_rates(origin, destination, packages)

This request causes an error: ActiveMerchant::Shipping::ResponseError (ERROR - 1000: Authentication Failed)

Also I'm confused with all that APIs keys (DHL, UPS etc). Can I use same account keys in different apps for each of carriers or should I make new ones for every app?


Solution

  • You should pass :test => true in with your other options to let it know to use the test URL rather than the production URL.

    You can see all the options and details here

    https://github.com/Shopify/active_shipping/blob/master/lib/active_shipping/shipping/carriers/fedex.rb

    In particular, make sure your other options are these:

    # :key is your developer API key
    # :password is your API password
    # :account is your FedEx account number
    # :login is your meter number