Three lines

Uber

Developers

Receipt Ready Notification

WEBHOOK: POSThttps://<YOUR_WEBHOOK_URI> event_type: business_trips.receipt_ready

Event indicating that a receipt has been created for the trip. Sent upon completion of a trip or update to the final fare of a trip taken on the organization’s profile.

Retry Attempts

If for some reason the Uber API cannot reach the webhook URL you specified either due to networking issues or application issues on your end, the webhooks service will retry to make a request.

We have implemented an exponential back-off algorithm with a back-off multiplier of 30 seconds which will make up to 7 attempts. This means we will attempt to request your webhook URL up to 7 times across roughly 1 hour.

Webhook Headers

The Uber API will insert specialized headers for all requests made to your webhook URL to help your application utilize them appropriately.

Header Description
X-Environment Indicates if this request is coming from the production or sandbox API.
X-Uber-Signature SHA256 hash of the request body, computed using the app’s signing key as the key.

Webhook Security

Webhook messages are signed so that your app can verify that the sender is Uber. Webhooks requests contain an X-Uber-Signature header. The value of this field is a hexadecimal HMAC signature of the webhook HTTP request body, using signing key of primary webhook url as a key and SHA256 as the hash function.

Python Example

digester = hmac.new(signing_key, webhook_body, hashlib.sha256)
return digester.hexdigest()

Due to a strict interpretation of the JSON specification by JavaScript, if there are backslashes sent in the POST body, they will be removed upon parsing. This prevents webhook receivers implemented in NodeJS from verifying the webhook signature accurately. We are working on removing all backslashes from the payload in order to avoid this situation and will remove this note when that work is done.

Polling

For critical applications, we recommend complementing your webhooks implementation with regular polling in case webhook notifications are lost.

Webhook Event Structure

Name Type Description
event_id string Unique event identifier, which can be used to ensure that events are only digested once.
event_time integer Unix timestamp of the time the event occurred.
event_type string The type of event that occurred.
resource_href string The URL of the resource being referenced. This URL can be called with your App’s bearer token to retrieve the full payload.
meta object The object containing additional information that is specific to the event_type.
meta.user_id string Unique identifier of the user this event was generated for.
meta.rider_id string Unique identifier of the rider this event was generated for.
meta.resource_id string Unique identifier of the resource this event has been generated for.
meta.status string The current status of the receipt.
webhook_meta object The object containing additional information that is specific to the webhook.
webhook_meta.client_id string Client ID for the developer
webhook_meta.webhook_config_id string Unique identifier of the webhook type.
webhook_meta.webhook_msg_timestamp integer Unix timestamp of the time the when webhook event was pushed.
webhook_meta.webhook_msg_uuid string Unique identifier, which can be used to ensure that the webhooks are digested only once.
Example Webhook
Production trip
{
   "event_id": "3a3f3da4-14ac-4056-bbf2-d0b9cdcb0777",
   "event_time": 1427343990,
   "event_type": "business_trips.receipt_ready",
   "meta": {
       "user_id": "d13dff8b-das-asd-1212e",
       "resource_id": "5152dcc5-b88d-4754-8b33-975f4067c943",
       "status": "ready"
   },
   "resource_href": "https://api.uber.com/v1/business/trips/5152dcc5-b88d-4754-8b33-975f4067c943/receipt",
   "webhook_meta": {
       "client_id": "developer_client_id",
       "webhook_config_id": "u4b-business.receipt",
       "webhook_msg_timestamp": 1648040400,
       "webhook_msg_uuid": "03310533-1ec3-4a5b-b693-40008a13feb9"
    }
}
Sandbox trip
{
   "event_id": "3a3f3da4-14ac-4056-bbf2-d0b9cdcb0777",
   "event_time": 1427343990,
   "event_type": "business_trips.receipt_ready",
   "meta": {
       "user_id": "d13dff8b-das-asd-1212e",
       "resource_id": "6852dcc5-b88d-4754-8b33-975f4067c943",
       "status": "ready"
   },
   "resource_href": "https://sandbox-api.uber.com/v1/business/trips/6852dcc5-b88d-4754-8b33-975f4067c943/receipt",
   "webhook_meta": {
       "client_id": "developer_client_id",
       "webhook_config_id": "u4b-business.receipt",
       "webhook_msg_timestamp": 1648040400,
       "webhook_msg_uuid": "08910533-1ec3-4a5b-b693-40008a13feb9"
    }
}

Uber

Developers
© 2023 Uber Technologies Inc.