tylerSF
tylerSF

Reputation: 1539

Uber API 409 error: fare_expired

My web app was working great on sandbox. I changed all of my requests from https://sandbox-api.uber.com/v1/... to https://api.uber.com/v1/... and now I'm getting an error I've never seen before.

Here are the details of the error:

Status: 409

Code: fare_expired

Title: The fare has expired. Please get estimates again, confirm the new fare, and then re-request.

I can't find any documentation on Uber's site on this specific error. I know that surge pricing acceptance can expire and have to be reauthorized, but I'm getting this error on the very first ride request.

Has anybody else seen this error? Happy to share more details as needed.

This is my ruby code where I make the ride request to Uber:

@uber_ride = JSON.load(RestClient::Request.execute(
      :method => :post,
      :url => "https://api.uber.com/v1/requests",
      :payload => '{"start_latitude":' + lat_start.to_s + ',"start_longitude":' + lng_start.to_s + ',"end_latitude":' + lat_end.to_s + ',"end_longitude":' + lng_end.to_s + ',"product_id":"' + @uberx_id.to_s + '","surge_confirmation_id":"' + surge_id.to_s + '"}',
      :headers => {'Authorization' => 'Bearer ' + session[:request_token], :content_type => 'application/json'}
    ))

Upvotes: 1

Views: 2376

Answers (1)

tylerSF
tylerSF

Reputation: 1539

The way I resolved this error was by hitting the /V1/ESTIMATES/PRICE endpoint BEFORE the request endpoint. I think this error message stems from Uber wanting you to present an estimated price to the user before submitting a request on their behalf.

Upvotes: 2

Related Questions