Three lines

Uber

Developers

Code Samples

The purpose of this guide is to provide code samples in most commonly used programming languages. Namely

  • Python
  • PHP

The examples that we provided are for various possible HTTP methods as opposed to every endpoint that is offered in this product.

Python

GET : Fetch Trip Receipt

import requests

url = "https://api.uber.com/v1/business/trips/{{trip_id}}/receipt"

payload={}
headers = {
  'Authorization': 'Bearer {{access_token}}'
}

response = requests.request("GET", url, headers=headers, data=payload)

print(response.text)

PHP

GET : Fetch Trip Receipt

<?php

$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => 'https://api.uber.com/v1/business/trips/%7B%7Btrip_id%7D%7D/receipt',
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => '',
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 0,
  CURLOPT_FOLLOWLOCATION => true,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => 'GET',
  CURLOPT_HTTPHEADER => array(
    'Authorization: Bearer {{access_token}}'
  ),
));

$response = curl_exec($curl);

curl_close($curl);
echo $response;

Uber

Developers
© 2023 Uber Technologies Inc.