Bad request on customer creation?


(Chris O'donnell) #1

on user

class User
 def create_dwolla_customer
    dwolla_token = DwollaToken.current
    puts dwolla_attributes
    customer = dwolla_token.post "customers", dwolla_attributes

    binding.pry
  end

  private

  def dwolla_attributes
    { firstName: first_name, lastName: last_name, email: email }
  end

end

APi call is responding with:

 DwollaV2::BadRequestError:
   {"code"=>"BadRequest", "message"=>"The request body contains bad syntax or is incomplete."}

(Spencer Hunter) #2

Hey @chris, Can you output the raw JSON request body that is getting sent to the API? Are you making sure the required fields (firstName, lastName, and email) have valid string value? I’m wondering if you are sending null as a value…


(Chris O'donnell) #3

@spencer, It was my refresh token, it was invalid. I need to raise an error if the token is bad. However the token is good for 60 days. it could have only been a few days old not sure why it was not authenticating correctly.