### Batch Create Transit Objects in C# (Setup) Source: https://developers.google.com/wallet/tickets/transit-passes/qr-code/resources/performance-tips This C# snippet shows the initial setup for making batch requests to Google Wallet. It includes setting up an HttpClient and authorizing the request with a bearer token. The actual object creation logic would follow. ```csharp /// /// Batch create Google Wallet objects from an existing class. /// /// The issuer ID being used for this request. /// Developer-defined unique ID for this pass class. public async void BatchCreateObjects(string issuerId, string classSuffix) { // The request body will be a multiline string // See below for more information // https://cloud.google.com/compute/docs/api/how-tos/batch//example string data = ""; HttpClient httpClient = new HttpClient(); httpClient.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue( "Bearer", credentials.GetAccessTokenForRequestAsync().Result ); ``` -------------------------------- ### Public Key Example Source: https://developers.google.com/wallet/smart-tap/introduction/issuer-configuration This is an example of a public key in PEM format. ```text -----BEGIN PUBLIC KEY----- MFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAEchyXj869zfmKhRi9xP7f2AK07kEo 4lE7ZlWTN14jh4YBTny+hRGRXcUzevV9zSSPJlPHpqqu5pEwlv1xyFvE1w== -----END PUBLIC KEY----- ``` -------------------------------- ### C# Authentication Setup Source: https://developers.google.com/wallet/tickets/boarding-passes/use-cases/auth Sets up service account credentials and the Google Wallet API service client in C#. ```csharp using System.IdentityModel.Tokens.Jwt; using System.Net.Http.Headers; using System.Text.RegularExpressions; using Google.Apis.Auth.OAuth2; using Google.Apis.Services; using Google.Apis.Walletobjects.v1; using Google.Apis.Walletobjects.v1.Data; using Microsoft.IdentityModel.Tokens; using Newtonsoft.Json; using Newtonsoft.Json.Linq; /// /// Demo class for creating and managing Flights in Google Wallet. /// class DemoFlight { /// /// Path to service account key file from Google Cloud Console. Environment /// variable: GOOGLE_APPLICATION_CREDENTIALS. /// public static string keyFilePath; /// /// Service account credentials for Google Wallet APIs /// public static ServiceAccountCredential credentials; /// /// Google Wallet service client /// public static WalletobjectsService service; public DemoFlight() { keyFilePath = Environment.GetEnvironmentVariable( "GOOGLE_APPLICATION_CREDENTIALS") ?? "/path/to/key.json"; Auth(); } ``` ```csharp /// /// Create authenticated service client using a service account file. /// public void Auth() { credentials = (ServiceAccountCredential)GoogleCredential .FromFile(keyFilePath) .CreateScoped(new List { WalletobjectsService.ScopeConstants.WalletObjectIssuer }) .UnderlyingCredential; service = new WalletobjectsService( new BaseClientService.Initializer() { HttpClientInitializer = credentials }); } ``` -------------------------------- ### PHP Example for Event Ticket Template Source: https://developers.google.com/wallet/tickets/events/resources/template This PHP code provides an example of how to define a custom event ticket template, mirroring the structure and functionality shown in the Python and Java examples. ```php 'ticket.eventName', ]); // Card template override $cardTemplateOverride = new CardTemplateOverride([ 'card_title' => $cardTitle, // Add other card template overrides as needed ]); // Barcode $barcode = new Barcode([ 'type' => 'QR_CODE', 'value' => 'event.ticket.barcodeValue', 'alternate_text' => 'event.ticket.barcodeAlternateText', ]); // Details template // Text module example $textModule = new TextModule([ 'header' => 'Event Info', 'body' => 'event.ticket.eventDescription', 'id' => 'event_info_module', ]); // Image module example $imageModule = new ImageModule([ 'image' => new Image([ 'content_type' => 'image/png', 'file_uri' => 'event.ticket.eventImageUri', ]), 'id' => 'event_image_module', ]); // Link module example $linkModule = new LinkModule([ 'uri' => new FieldReference(['field_name' => 'event.ticket.eventWebsiteUri']), 'description' => 'Visit our website', 'id' => 'event_website_link', ]); // Predefined details example $predefinedDetails = new PredefinedDetails([ 'event_details' => new EventDetails([ 'event_type' => 'CONCERT', 'event_name' => new FieldReference(['field_name' => 'ticket.eventName']), 'venue_name' => new FieldReference(['field_name' => 'ticket.venueName']), 'venue_address' => new FieldReference(['field_name' => 'ticket.venueAddress']), 'start_time' => new TimeInterval([ 'start_time' => '2024-08-15T19:00:00Z', 'end_time' => '2024-08-15T23:00:00Z', ]), // Add other event details as needed ]), // Add other predefined details as needed ]); // Create the EventTicketClass with overrides $customEventTicketClass = new EventTicketClass([ 'template_override' => $cardTemplateOverride, 'barcode' => $barcode, // Add modules and predefined details to the class 'modules' => [$textModule, $imageModule, $linkModule], 'predefined_details' => $predefinedDetails, // Add other event ticket class properties as needed ]); // Example of how this might be used with a TicketClass // $ticketClass = new TicketClass([ // 'id' => 'your_ticket_class_id', // 'event_ticket_class' => $customEventTicketClass, // // ... other TicketClass properties // ]); echo $customEventTicketClass->serializeToJsonString(); ?> ``` -------------------------------- ### Java Authentication Setup Source: https://developers.google.com/wallet/retail/loyalty-cards/use-cases/auth Sets up authentication using a service account key file and initializes the Google Wallet service client. Ensure the GOOGLE_APPLICATION_CREDENTIALS environment variable is set or provide the key file path. ```java import com.auth0.jwt.JWT; import com.auth0.jwt.algorithms.Algorithm; import com.google.api.client.googleapis.batch.BatchRequest; import com.google.api.client.googleapis.batch.json.JsonBatchCallback; import com.google.api.client.googleapis.javanet.GoogleNetHttpTransport; import com.google.api.client.googleapis.json.GoogleJsonError; import com.google.api.client.googleapis.json.GoogleJsonResponseException; import com.google.api.client.http.*; import com.google.api.client.json.gson.GsonFactory; import com.google.api.services.walletobjects.*; import com.google.api.services.walletobjects.model.*; import com.google.auth.http.HttpCredentialsAdapter; import com.google.auth.oauth2.GoogleCredentials; import com.google.auth.oauth2.ServiceAccountCredentials; import java.io.*; import java.security.interfaces.RSAPrivateKey; import java.util.*; /** Demo class for creating and managing Loyalty cards in Google Wallet. */ public class DemoLoyalty { /** * Path to service account key file from Google Cloud Console. Environment variable: * GOOGLE_APPLICATION_CREDENTIALS. */ public static String keyFilePath; /** Service account credentials for Google Wallet APIs. */ public static GoogleCredentials credentials; /** Google Wallet service client. */ public static Walletobjects service; public DemoLoyalty() throws Exception { keyFilePath = System.getenv().getOrDefault("GOOGLE_APPLICATION_CREDENTIALS", "/path/to/key.json"); auth(); } ``` -------------------------------- ### Place ID Example Source: https://developers.google.com/wallet/tickets/open-loop/technical-integration/station-and-stop-names Example of the Place ID from Google Maps, required for fixed terminals. ```text ChIJFapKOPSn2EcRHP3RbxxWlTI ``` -------------------------------- ### C# Authentication Setup Source: https://developers.google.com/wallet/retail/offers/use-cases/auth Initializes service account credentials and the Google Wallet API service client in C#. ```csharp using System.IdentityModel.Tokens.Jwt; using System.Net.Http.Headers; using System.Text.RegularExpressions; using Google.Apis.Auth.OAuth2; using Google.Apis.Services; using Google.Apis.Walletobjects.v1; using Google.Apis.Walletobjects.v1.Data; using Microsoft.IdentityModel.Tokens; using Newtonsoft.Json; using Newtonsoft.Json.Linq; /// /// Demo class for creating and managing Offers in Google Wallet. /// class DemoOffer { /// /// Path to service account key file from Google Cloud Console. Environment /// variable: GOOGLE_APPLICATION_CREDENTIALS. /// public static string keyFilePath; /// /// Service account credentials for Google Wallet APIs /// public static ServiceAccountCredential credentials; /// /// Google Wallet service client /// public static WalletobjectsService service; public DemoOffer() { keyFilePath = Environment.GetEnvironmentVariable( "GOOGLE_APPLICATION_CREDENTIALS") ?? "/path/to/key.json"; Auth(); } ``` ```csharp /// /// Create authenticated service client using a service account file. /// public void Auth() { credentials = (ServiceAccountCredential)GoogleCredential .FromFile(keyFilePath) .CreateScoped(new List { WalletobjectsService.ScopeConstants.WalletObjectIssuer }) .UnderlyingCredential; service = new WalletobjectsService( new BaseClientService.Initializer() { HttpClientInitializer = credentials }); } ``` -------------------------------- ### Operator Name Example Source: https://developers.google.com/wallet/tickets/open-loop/technical-integration/station-and-stop-names Example of the operator name, which is the transit agency operating the station or route. ```text TfL ``` -------------------------------- ### Language Example Source: https://developers.google.com/wallet/tickets/open-loop/technical-integration/station-and-stop-names Example of the language code for the full display name, following ISO 639-1 standards. ```text EN ``` -------------------------------- ### C# Authentication Setup Source: https://developers.google.com/wallet/retail/loyalty-cards/use-cases/auth Sets up authentication for Google Wallet API using a service account key file. Ensure the GOOGLE_APPLICATION_CREDENTIALS environment variable is set. ```csharp using System.IdentityModel.Tokens.Jwt; using System.Net.Http.Headers; using System.Text.RegularExpressions; using Google.Apis.Auth.OAuth2; using Google.Apis.Services; using Google.Apis.Walletobjects.v1; using Google.Apis.Walletobjects.v1.Data; using Microsoft.IdentityModel.Tokens; using Newtonsoft.Json; using Newtonsoft.Json.Linq; /// /// Demo class for creating and managing Loyalty cards in Google Wallet. /// class DemoLoyalty { /// /// Path to service account key file from Google Cloud Console. Environment /// variable: GOOGLE_APPLICATION_CREDENTIALS. /// public static string keyFilePath; /// /// Service account credentials for Google Wallet APIs /// public static ServiceAccountCredential credentials; /// /// Google Wallet service client /// public static WalletobjectsService service; public DemoLoyalty() { keyFilePath = Environment.GetEnvironmentVariable( "GOOGLE_APPLICATION_CREDENTIALS") ?? "/path/to/key.json"; Auth(); } ``` -------------------------------- ### C# Authentication Setup Source: https://developers.google.com/wallet/retail/gift-cards/use-cases/auth Sets up service account credentials and the Google Wallet API service client in C#. Ensure the GOOGLE_APPLICATION_CREDENTIALS environment variable is set or provide the key file path. ```csharp using System.IdentityModel.Tokens.Jwt; using System.Net.Http.Headers; using System.Text.RegularExpressions; using Google.Apis.Auth.OAuth2; using Google.Apis.Services; using Google.Apis.Walletobjects.v1; using Google.Apis.Walletobjects.v1.Data; using Microsoft.IdentityModel.Tokens; using Newtonsoft.Json; using Newtonsoft.Json.Linq; /// /// Demo class for creating and managing Gift cards in Google Wallet. /// class DemoGiftCard { /// /// Path to service account key file from Google Cloud Console. Environment /// variable: GOOGLE_APPLICATION_CREDENTIALS. /// public static string keyFilePath; /// /// Service account credentials for Google Wallet APIs /// public static ServiceAccountCredential credentials; /// /// Google Wallet service client /// public static WalletobjectsService service; public DemoGiftCard() { keyFilePath = Environment.GetEnvironmentVariable( "GOOGLE_APPLICATION_CREDENTIALS") ?? "/path/to/key.json"; Auth(); } ``` ```csharp /// /// Create authenticated service client using a service account file. /// public void Auth() { credentials = (ServiceAccountCredential)GoogleCredential .FromFile(keyFilePath) .CreateScoped(new List { WalletobjectsService.ScopeConstants.WalletObjectIssuer }) .UnderlyingCredential; service = new WalletobjectsService( new BaseClientService.Initializer() { HttpClientInitializer = credentials }); } ``` -------------------------------- ### Stop ID/Route ID Example Source: https://developers.google.com/wallet/tickets/open-loop/technical-integration/station-and-stop-names Example of the GTFS ID for a stop or route, used for fixed or mobile terminals respectively. ```text 123456789 ``` -------------------------------- ### Callback Message Format Example Source: https://developers.google.com/wallet/retail/gift-cards/use-cases/use-callbacks-for-saves-and-deletions This is an example of the JSON message format sent to your callback endpoint for save or delete events. ```json { "classId": "issuer_id.class_id", "objectId": "issuer_id.object_id", "expTimeMillis": "1234567890000", "eventType": "save", "nonce": "random_string" } ``` -------------------------------- ### C# Authentication Setup Source: https://developers.google.com/wallet/generic/use-cases/auth Initializes the Google Wallet API client using service account credentials. Ensure the GOOGLE_APPLICATION_CREDENTIALS environment variable is set. ```csharp using System.IdentityModel.Tokens.Jwt; using System.Net.Http.Headers; using System.Text.RegularExpressions; using Google.Apis.Auth.OAuth2; using Google.Apis.Services; using Google.Apis.Walletobjects.v1; using Google.Apis.Walletobjects.v1.Data; using Microsoft.IdentityModel.Tokens; using Newtonsoft.Json; using Newtonsoft.Json.Linq; /// /// Demo class for creating and managing Generic passes in Google Wallet. /// class DemoGeneric { /// /// Path to service account key file from Google Cloud Console. Environment /// variable: GOOGLE_APPLICATION_CREDENTIALS. /// public static string keyFilePath; /// /// Service account credentials for Google Wallet APIs /// public static ServiceAccountCredential credentials; /// /// Google Wallet service client /// public static WalletobjectsService service; public DemoGeneric() { keyFilePath = Environment.GetEnvironmentVariable( "GOOGLE_APPLICATION_CREDENTIALS") ?? "/path/to/key.json"; Auth(); } ``` -------------------------------- ### Example SHA-1 Fingerprint Format Source: https://developers.google.com/wallet/generic/getting-started/auth/android This is an example of how your app's SHA-1 fingerprint should be formatted. Ensure your fingerprint matches this structure. ```text DA:39:A3:EE:5E:6B:4B:0D:32:55:BF:EF:95:60:18:90:AF:D8:07:09 ``` -------------------------------- ### C# Authentication Setup Source: https://developers.google.com/wallet/tickets/transit-passes/qr-code/use-cases/auth Initializes service account credentials and the Google Wallet API service client in C#. Ensure the GOOGLE_APPLICATION_CREDENTIALS environment variable is set. ```csharp using System.IdentityModel.Tokens.Jwt; using System.Net.Http.Headers; using System.Text.RegularExpressions; using Google.Apis.Auth.OAuth2; using Google.Apis.Services; using Google.Apis.Walletobjects.v1; using Google.Apis.Walletobjects.v1.Data; using Microsoft.IdentityModel.Tokens; using Newtonsoft.Json; using Newtonsoft.Json.Linq; /// /// Demo class for creating and managing Transit passes in Google Wallet. /// class DemoTransit { /// /// Path to service account key file from Google Cloud Console. Environment /// variable: GOOGLE_APPLICATION_CREDENTIALS. /// public static string keyFilePath; /// /// Service account credentials for Google Wallet APIs /// public static ServiceAccountCredential credentials; /// /// Google Wallet service client /// public static WalletobjectsService service; public DemoTransit() { keyFilePath = Environment.GetEnvironmentVariable( "GOOGLE_APPLICATION_CREDENTIALS") ?? "/path/to/key.json"; Auth(); } ``` -------------------------------- ### Python Authentication Setup Source: https://developers.google.com/wallet/retail/gift-cards/use-cases/auth Creates an authenticated HTTP client using a service account file in Python. It specifies the key file path and the required scope for the Wallet Objects API. ```python def auth(self): """Create authenticated HTTP client using a service account file.""" self.credentials = Credentials.from_service_account_file( self.key_file_path, scopes=['https://www.googleapis.com/auth/wallet_object.issuer']) self.client = build('walletobjects', 'v1', credentials=self.credentials) ``` -------------------------------- ### Location Name and Details Example Source: https://developers.google.com/wallet/tickets/open-loop/technical-integration/station-and-stop-names Example of the location name and details, which must uniquely identify a location and be prefixed by the PTO acronym. ```text TfL_Abbey Road ``` -------------------------------- ### Node.js Authentication Setup Source: https://developers.google.com/wallet/tickets/transit-passes/qr-code/use-cases/auth Initializes the service account key file path and sets up authentication for the Google Wallet API in Node.js. The key file path can be provided via an environment variable. ```javascript const { google } = require('googleapis'); const jwt = require('jsonwebtoken'); const { v4: uuidv4 } = require('uuid'); /** * Demo class for creating and managing Transit passes in Google Wallet. */ class DemoTransit { constructor() { /** * Path to service account key file from Google Cloud Console. Environment * variable: GOOGLE_APPLICATION_CREDENTIALS. */ this.keyFilePath = process.env.GOOGLE_APPLICATION_CREDENTIALS || '/path/to/key.json'; this.auth(); } ``` -------------------------------- ### Supported ticketToken Examples Source: https://developers.google.com/wallet/tickets/boarding-passes/use-cases/import-from-gmail Examples of valid `ticketToken` values for different code types like barcode128, pdf417, qrCode, and aztecCode. ```text barcode128:M1HANFENG/ZHU EMWLPJ SFOAUSGG 123 350J25A 614a 10A1973966772 pdf417:M1HANFENG/ZHU EMWLPJ SFOAUSGG 123 350J25A 614a 10A1973966772 qrCode:M1HANFENG/ZHU EMWLPJ SFOAUSGG 123 350J25A 614a 10A1973966772 aztecCode:M1HANFENG/ZHU EMWLPJ SFOAUSGG 123 350J25A 614a 10A1973966772 ``` -------------------------------- ### Partial Resource Response Example Source: https://developers.google.com/wallet/retail/gift-cards/resources/performance-tips This is an example of a partial JSON response containing only the requested fields ('kind' and 'items' with 'title' and 'characteristics/length'). ```JSON { "kind": "demo", "items": [ { "title": "First title", "characteristics": { "length": "short" } }, { "title": "Second title", "characteristics": { "length": "long" } } ] } ``` -------------------------------- ### PHP Authentication Setup Source: https://developers.google.com/wallet/retail/gift-cards/use-cases/auth Initializes the Google API client, service account credentials, and the Google Wallet service client in PHP. The key file path can be set via the GOOGLE_APPLICATION_CREDENTIALS environment variable. ```PHP use Firebase\JWT\JWT; use Google\Auth\Credentials\ServiceAccountCredentials; use Google\Client as GoogleClient; use Google\Service\Walletobjects; use Google\Service\Walletobjects\DateTime; use Google\Service\Walletobjects\Money; use Google\Service\Walletobjects\LatLongPoint; use Google\Service\Walletobjects\Barcode; use Google\Service\Walletobjects\ImageModuleData; use Google\Service\Walletobjects\LinksModuleData; use Google\Service\Walletobjects\TextModuleData; use Google\Service\Walletobjects\TranslatedString; use Google\Service\Walletobjects\LocalizedString; use Google\Service\Walletobjects\ImageUri; use Google\Service\Walletobjects\Image; use Google\Service\Walletobjects\GiftCardObject; use Google\Service\Walletobjects\Message; use Google\Service\Walletobjects\AddMessageRequest; use Google\Service\Walletobjects\Uri; use Google\Service\Walletobjects\GiftCardClass; /** Demo class for creating and managing Gift cards in Google Wallet. */ class DemoGiftCard { /** * The Google API Client * https://github.com/google/google-api-php-client */ public GoogleClient $client; /** * Path to service account key file from Google Cloud Console. Environment * variable: GOOGLE_APPLICATION_CREDENTIALS. */ public string $keyFilePath; /** * Service account credentials for Google Wallet APIs. */ public ServiceAccountCredentials $credentials; /** * Google Wallet service client. */ public Walletobjects $service; public function __construct() { $this->keyFilePath = getenv('GOOGLE_APPLICATION_CREDENTIALS') ?: '/path/to/key.json'; $this->auth(); } ``` -------------------------------- ### Node.js Authentication Setup Source: https://developers.google.com/wallet/retail/gift-cards/use-cases/auth Initializes the DemoGiftCard class with service account credentials path for Node.js. The key file path is read from the GOOGLE_APPLICATION_CREDENTIALS environment variable or defaults to '/path/to/key.json'. ```javascript const { google } = require('googleapis'); const jwt = require('jsonwebtoken'); const { v4: uuidv4 } = require('uuid'); /** * Demo class for creating and managing Gift cards in Google Wallet. */ class DemoGiftCard { constructor() { /** * Path to service account key file from Google Cloud Console. Environment * variable: GOOGLE_APPLICATION_CREDENTIALS. */ this.keyFilePath = process.env.GOOGLE_APPLICATION_CREDENTIALS || '/path/to/key.json'; this.auth(); } ``` -------------------------------- ### AppTarget with Package Name Example Source: https://developers.google.com/wallet/reference/rest/v1/AppLinkData This example demonstrates how to specify a package name for an AppTarget, which is used to open a specific Android application. ```json { "packageName": "com.google.android.gm" } ``` -------------------------------- ### Example Add to Google Wallet Link Source: https://developers.google.com/wallet/generic/web An example of a fully-formed 'Add to Google Wallet' link, including an encoded and signed JWT. ```url https://pay.google.com/gp/v/save/eyJhbGci6IkpXVCJ9.eyJhdWQiO...6EkC1Ahp6A ``` -------------------------------- ### PHP Authentication and Client Initialization Source: https://developers.google.com/wallet/generic/use-cases/auth Sets up service account credentials and initializes the Google Client and Walletobjects service for API calls. Requires application name and scopes to be set. ```php /** * Create authenticated HTTP client using a service account file. */ public function auth() { $this->credentials = new ServiceAccountCredentials( Walletobjects::WALLET_OBJECT_ISSUER, $this->keyFilePath ); // Initialize Google Wallet API service $this->client = new GoogleClient(); $this->client->setApplicationName('APPLICATION_NAME'); $this->client->setScopes(Walletobjects::WALLET_OBJECT_ISSUER); $this->client->setAuthConfig($this->keyFilePath); $this->service = new Walletobjects($this->client); } ``` -------------------------------- ### Python Authentication Setup Source: https://developers.google.com/wallet/generic/use-cases/auth Initializes the Google Wallet API client using service account credentials. Ensure the GOOGLE_APPLICATION_CREDENTIALS environment variable is set. ```python import json import os import uuid from googleapiclient.discovery import build from googleapiclient.errors import HttpError from google.oauth2.service_account import Credentials from google.auth import jwt, crypt class DemoGeneric: """Demo class for creating and managing Generic passes in Google Wallet. Attributes: key_file_path: Path to service account key file from Google Cloud Console. Environment variable: GOOGLE_APPLICATION_CREDENTIALS. base_url: Base URL for Google Wallet API requests. """ def __init__(self): self.key_file_path = os.environ.get('GOOGLE_APPLICATION_CREDENTIALS', '/path/to/key.json') # Set up authenticated client self.auth() ``` -------------------------------- ### Full Display Name Example Source: https://developers.google.com/wallet/tickets/open-loop/technical-integration/station-and-stop-names Example of the full display name, which is the value shown in Google Wallet and must match the GTFS feed. ```text Abbey Road Tram Station ``` -------------------------------- ### Node.js Authentication Setup Source: https://developers.google.com/wallet/tickets/events/use-cases/auth Initializes service account credentials and the Google Wallet API service client in Node.js. ```javascript const { google } = require('googleapis'); const jwt = require('jsonwebtoken'); const { v4: uuidv4 } = require('uuid'); /** * Demo class for creating and managing Event tickets in Google Wallet. */ class DemoEventTicket { constructor() { /** * Path to service account key file from Google Cloud Console. Environment * variable: GOOGLE_APPLICATION_CREDENTIALS. */ this.keyFilePath = process.env.GOOGLE_APPLICATION_CREDENTIALS || '/path/to/key.json'; this.auth(); } ``` -------------------------------- ### Example Full Resource Response Source: https://developers.google.com/wallet/generic/resources/performance-tips A typical full resource response includes all fields associated with the resource. This example shows a 'demo' resource with 'items'. ```json { "kind": "demo", ... "items": [ { "title": "First title", "comment": "First comment.", "characteristics": { "length": "short", "accuracy": "high", "followers": ["Jo", "Will"], }, "status": "active", ... }, { "title": "Second title", "comment": "Second comment.", "characteristics": { "length": "long", "accuracy": "medium" "followers": [ ], }, "status": "pending", ... }, ... ] } ``` -------------------------------- ### Java Authentication Setup Source: https://developers.google.com/wallet/tickets/events/use-cases/auth Initializes Google Wallet API service client with service account credentials. Ensure the GOOGLE_APPLICATION_CREDENTIALS environment variable is set or provide the key file path directly. ```java import com.auth0.jwt.JWT; import com.auth0.jwt.algorithms.Algorithm; import com.google.api.client.googleapis.batch.BatchRequest; import com.google.api.client.googleapis.batch.json.JsonBatchCallback; import com.google.api.client.googleapis.javanet.GoogleNetHttpTransport; import com.google.api.client.googleapis.json.GoogleJsonError; import com.google.api.client.googleapis.json.GoogleJsonResponseException; import com.google.api.client.http.*; import com.google.api.client.json.gson.GsonFactory; import com.google.api.services.walletobjects.*; import com.google.api.services.walletobjects.model.*; import com.google.auth.http.HttpCredentialsAdapter; import com.google.auth.oauth2.GoogleCredentials; import com.google.auth.oauth2.ServiceAccountCredentials; import java.io.*; import java.security.interfaces.RSAPrivateKey; import java.util.*; /** Demo class for creating and managing Event tickets in Google Wallet. */ public class DemoEventTicket { /** * Path to service account key file from Google Cloud Console. Environment variable: * GOOGLE_APPLICATION_CREDENTIALS. */ public static String keyFilePath; /** Service account credentials for Google Wallet APIs. */ public static GoogleCredentials credentials; /** Google Wallet service client. */ public static Walletobjects service; public DemoEventTicket() throws Exception { keyFilePath = System.getenv().getOrDefault("GOOGLE_APPLICATION_CREDENTIALS", "/path/to/key.json"); auth(); } ``` -------------------------------- ### CSV Example for Station and Stop Names Source: https://developers.google.com/wallet/tickets/open-loop/technical-integration/station-and-stop-names This is an example row of a spreadsheet and its corresponding CSV format for Google Wallet transit integration. It shows the required columns and sample data. ```csv Operator,Location name/details,Full display name for Google Wallet,Language,Place ID,Stop / Route ID TfL,TfL_Abbey Road,Abbey Road Tram Station,EN,ChIJFapKOPSn2EcRHP3RbxxWlTI,123456789 ```