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://#{}"
  path = "/campaigns/#{}/contributions/#{}/success"
  response = call(
    :key => @key,
    :secret => @secret,
    :allowFundingSources => true,
    :test => !,
    :redirect => "#{base}#{path}",
    :callback => "#{base}/sites/#{}#{path}",
    :purchaseOrder => {
      :customerInfo => {: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 =>,
        :description => contribution.description,
        :price => contribution.amount.to_money.to_s,
        :quantity => 1

def call(call, params)
  response = + call), params.to_json, :content_type => :json, :accept => :json)

(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 => !, but it returns the same result. Is there any other way that i can test? I am using as api endpoint and the credential is from the application in

(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.