2016-12-28 83 views
0

使用https://api.uber.com/v1.2/estimates/price代替“high_estimate”:11.0和“low_estimate”:8.0 或“估计”:“$ 13-17”?有没有一种方法可以像Uber应用一样获得精确的票价?如何使用Uber API获取精确的票价而不是票价估算?

{ 
    "localized_display_name": "uberX", 
    "distance": 12.88, 
    "display_name": "uberX", 
    "product_id": "2143f90b-ce68-4f6d-a113-4872b207e626", 
    "high_estimate": 17.0, 
    "low_estimate": 13.0, 
    "duration": 1800, 
    "estimate": "$13-17", 
    "currency_code": "USD" 
}, 

回答

3

您提到的功能称为“前期票价”。它正在推出gradually in cities across the globe

通过查看GET /v1.2/products,您可以查看哪些产品启用了Upfront Fare。如果upfront_fare_enabled设置为true,则可以通过POST /v1.2/requests/estimate获得启用产品的前期票价,以获得fare_idfare_id可用于锁定旅程的前期票价和到达时间。 fare_id两分钟后过期。 最后,您可以使用POST /requests请求搭乘上一步返回的fare_id

您还应该阅读最新票价here的最佳实践。

+0

但仍优步应用程序和前期票价功能不提供相同的速度。有时2美分,有时更像是10美分的差价,例如Upfront Fare返回9.91美元,而Uber应用为9.93美元。 – arlen