Skip to content

Instantly share code, notes, and snippets.

@ArunGupta25
Created December 9, 2013 22:44
Show Gist options
  • Save ArunGupta25/7882405 to your computer and use it in GitHub Desktop.
Save ArunGupta25/7882405 to your computer and use it in GitHub Desktop.
authentication failure on paypal classic api
require 'paypal-sdk-adaptivepayments'
#set the api credentials
PayPal::SDK.configure(
:mode => "live",
:app_id => "APP-8TA367141A153745A",
:username => "arun_api1.wakemate.com",
:password => #HIDDEN,
:signature => "A5apZv808uLSmMYKU32Uz0S3VglPA4gSn10Qcf3-iJjfWBq-bMpQxEh8y")
@api = PayPal::SDK::AdaptivePayments::API.new
# First I tried a convert currency request
#build api request
@convert_currency = @api.build_convert_currency({
:baseAmountList => {
:currency => [{
:code => "USD",
:amount => 2.0 }] },
:convertToCurrencyList => {
:currencyCode => ["GBP"] } })
#make api request
@convert_currency_response = @api.convert_currency(@convert_currency)
#ERROR RESPONSE FROM PAYPAL SERVERS
=> #<PayPal::SDK::AdaptivePayments::DataTypes::ConvertCurrencyResponse:0x007fc299177150 @responseEnvelope=#<PayPal::SDK::AdaptivePayments::DataTypes::ResponseEnvelope:0x007fc299176fe8 @timestamp=Mon, 09 Dec 2013 13:37:06 -0800, @ack="Failure", @correlationId="a978929c5cb5c", @build="7935900">, @error=[#<PayPal::SDK::AdaptivePayments::DataTypes::ErrorData:0x007fc2991762f0 @errorId=520003, @domain="PLATFORM", @subdomain="Application", @severity="Error", @category="Application", @message="Authentication failed. API credentials are incorrect.">]>
@convert_currency_response.error
=> [#<PayPal::SDK::AdaptivePayments::DataTypes::ErrorData:0x007fc2991762f0 @errorId=520003, @domain="PLATFORM", @subdomain="Application", @severity="Error", @category="Application", @message="Authentication failed. API credentials are incorrect.">]
@convert_currency_response.error[0].errorId
=> 520003
@convert_currency_response.error[0].message
=> "Authentication failed. API credentials are incorrect."
#then I tried a simple payments request found in the SDK README on the github page
# Build request object
@pay = @api.build_pay({
:actionType => "PAY",
:cancelUrl => "http://localhost:3000/samples/adaptive_payments/pay",
:currencyCode => "USD",
:feesPayer => "SENDER",
:ipnNotificationUrl => "http://localhost:3000/samples/adaptive_payments/ipn_notify",
:receiverList => {
:receiver => [{
:amount => 1.0,
:email => "platfo_1255612361_per@gmail.com" }] },
:returnUrl => "http://localhost:3000/samples/adaptive_payments/pay" })
# Make API call & get response
@response = @api.pay(@pay)
#paypal response
=> #<PayPal::SDK::AdaptivePayments::DataTypes::PayResponse:0x007fc294972878 @responseEnvelope=#<PayPal::SDK::AdaptivePayments::DataTypes::ResponseEnvelope:0x007fc2949727b0 @timestamp=Mon, 09 Dec 2013 13:36:40 -0800, @ack="Failure", @correlationId="e0af0a32fbe87", @build="7935900">, @error=[#<PayPal::SDK::AdaptivePayments::DataTypes::ErrorData:0x007fc295f909c0 @errorId=520003, @domain="PLATFORM", @subdomain="Application", @severity="Error", @category="Application", @message="Authentication failed. API credentials are incorrect.">]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment