Invalid application credentials under sandbox


(Yong Gu) #1

When i use the api under sandbox, it always returns ‘{:Success=>false, :Message=>“Invalid application credentials.”, :Response=>nil}’. I am pretty sure that the credentials are right because it worked last week. Any advice?


(Gordon Zheng) #2

Weird. Can you show me the code you’re trying? Are you sure you’re setting the sandbox flag to true?


(Yong Gu) #3

@gordon Thanks for your mail. I did not use the dwolla-ruby gem but use RestClient directly. Here it the code:

def express(contribution)
  base = "http://#{@configuration.site.domain}"
  path = "/campaigns/#{contribution.campaign.link}/contributions/#{contribution.id}/success"
  response = call(
    '/oauth/rest/offsitegateway/checkouts',
    :key => @key,
    :secret => @secret,
    :allowFundingSources => true,
    :test => !@configuration.live,
    :redirect => "#{base}#{path}",
    :callback => "#{base}/sites/#{contribution.site.link}#{path}",
    :purchaseOrder => {
      :customerInfo => {:email => contribution.user.email},
      :destinationId => @dwolla_id, # 812-713-9234
      :tax => 0.to_f.to_money.to_s,
      :shipping => 0.to_f.to_money.to_s,
      :total => contribution.amount.to_money.to_s,
      :orderItems => [{
        :name => contribution.campaign.name,
        :description => contribution.description,
        :price => contribution.amount.to_money.to_s,
        :quantity => 1
      }]
    }
  )
  response
end

def call(call, params)
  response = RestClient.post((@api_endpoint + call), params.to_json, :content_type => :json, :accept => :json)
  JSON.parse(response.body).symbolize_keys
end

(Spencer Hunter) #4

@zerogy921 Make sure the param names match what is shown in the documentation. I noticed you are using key and secret, which are used for the legacy gateway endpoint.


(Yong Gu) #5

@spencer I have just changed the key and secret to client_id and client_secret, also removed :test => !@configuration.live, but it returns the same result. Is there any other way that i can test? I am using https://uat.dwolla.com as api endpoint and the credential is from the application in uat.dwolla.com.


(Spencer Hunter) #6

Hmm, do you want to direct message me your UAT credentials and I can give it a shot? Another thing to note is that the gateway API requires that you set the following header: “Content-Type: application/json” or else it will reject your request. Ensure/double check that your data is JSON-encoded and that the header is properly set.


(Yong Gu) #7

@spencer I have already sent the UAT credentials to you in private message and please let me the result after you check it. Thanks.


(Cory Anderson) #9

(Cory Anderson) #10

(Cory Anderson) #11