--- title: pos.cash-tracking-session-complete.event.observe description: |- Observes when cash tracking sessions complete, triggering when merchants finish cash handling operations. Use this target for monitoring cash handling completion for audit trails, compliance reporting, or operational analytics. Extensions at this target receive session data including the session ID, opening time, and closing time when a cash tracking session is completed. api_version: 2025-04 api_name: pos-ui-extensions source_url: html: https://shopify.dev/docs/api/pos-ui-extensions/2025-04/targets/pos-cash-tracking-session-complete-event-observe md: https://shopify.dev/docs/api/pos-ui-extensions/2025-04/targets/pos-cash-tracking-session-complete-event-observe.md --- # pos.​cash-tracking-session-complete.​event.​observe Observes when cash tracking sessions complete, triggering when merchants finish cash handling operations. Use this target for monitoring cash handling completion for audit trails, compliance reporting, or operational analytics. Extensions at this target receive session data including the session ID, opening time, and closing time when a cash tracking session is completed. ## CashTrackingSessionCompleteData The data object provided to this extension target. * cashTrackingSessionComplete { id: number; openingTime: string; closingTime: string; } required The cash tracking session complete data containing the session identifier, opening time, and closing time. This represents the full lifecycle of a cash drawer session from opening to closing. * connectivity ConnectivityState required The current Internet connectivity state of the POS device. Indicates whether the device is connected to or disconnected from the Internet. This state updates in real-time as connectivity changes, allowing extensions to adapt behavior for offline scenarios, show connectivity warnings, or queue operations for when connectivity is restored. * device Device required Comprehensive information about the physical POS device where the extension is currently running. Includes the device name, unique device ID, and form factor information (tablet vs other). This data is static for the session and helps extensions adapt to different device types, log device-specific information, or implement device-based configurations. * locale string required The [IETF BCP 47](https://en.wikipedia.org/wiki/IETF_language_tag) locale string for the current POS session (for example, `"en-US"`, `"fr-CA"`, `"de-DE"`). This indicates the merchant's language and regional preferences. Commonly used for internationalization (i18n), locale-specific date/time/number formatting, translating UI text, and providing localized content. The locale remains constant for the session and reflects the language selected in POS settings. * session Session required Comprehensive information about the current POS session including shop ID and domain, authenticated user, pinned staff member, active location, currency settings, and POS version. This session data remains constant for the session duration and provides critical context for business logic, permissions, API authentication, and transaction processing. Session data updates when users switch locations or change pinned staff members. ### ConnectivityState Represents the current Internet connectivity status of the device. Indicates whether the device is connected or disconnected from the Internet. * internetConnected Whether the device is connected to the Internet. Returns either \`Connected\` or \`Disconnected\` to indicate the current Internet connectivity status. Use for implementing connectivity-aware functionality, displaying connectivity indicators, or controlling network-dependent features. ```ts ConnectivityStateSeverity ``` ```ts export interface ConnectivityState { /** * Whether the device is connected to the Internet. Returns either `Connected` or `Disconnected` to indicate the current Internet connectivity status. Use for implementing connectivity-aware functionality, displaying connectivity indicators, or controlling network-dependent features. */ internetConnected: ConnectivityStateSeverity; } ``` ### ConnectivityStateSeverity ```ts 'Connected' | 'Disconnected' ``` ### Device Defines information about the POS device where the extension is running. * deviceId The unique identifier for the POS device. ```ts number ``` * isTablet Whether the device is a tablet form factor. ```ts boolean ``` * name The name of the POS device. ```ts string ``` ```ts export interface Device { /** * The name of the POS device. */ name: string; /** * The unique identifier for the POS device. */ deviceId: number; /** * Whether the device is a tablet form factor. */ isTablet: boolean; } ``` ### Session Defines information about the current POS session. * currency The \[ISO 4217]\(https://en.wikipedia.org/wiki/ISO\_4217) currency code associated with the location currently active on POS. ```ts CurrencyCode ``` * locationId The location ID associated with the POS device's current location. ```ts number ``` * posVersion The version of \[the POS app]\(https://apps.shopify.com/shopify-pos) currently running. ```ts string ``` * shopDomain The shop domain associated with the shop currently logged into POS. ```ts string ``` * shopId The shop ID associated with the shop currently logged into POS. ```ts number ``` * staffMemberId The staff ID of the staff member currently pinned into the POS. This may differ from the user ID if the pinned staff member is different from the logged-in user. ```ts number ``` * userId The user ID associated with the Shopify account currently authenticated on POS. ```ts number ``` ```ts export interface Session { /** * The shop ID associated with the shop currently logged into POS. */ shopId: number; /** * The user ID associated with the Shopify account currently authenticated on POS. */ userId: number; /** * The shop domain associated with the shop currently logged into POS. */ shopDomain: string; /** * The location ID associated with the POS device's current location. */ locationId: number; /** * The staff ID of the staff member currently pinned into the POS. This may differ from the user ID if the pinned staff member is different from the logged-in user. */ staffMemberId?: number; /** * The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) currency code associated with the location currently active on POS. */ currency: CurrencyCode; /** * The version of [the POS app](https://apps.shopify.com/shopify-pos) currently running. */ posVersion: string; } ``` ### CurrencyCode ```ts 'AED' | 'AFN' | 'ALL' | 'AMD' | 'ANG' | 'AOA' | 'ARS' | 'AUD' | 'AWG' | 'AZN' | 'BAM' | 'BBD' | 'BDT' | 'BGN' | 'BHD' | 'BIF' | 'BMD' | 'BND' | 'BOB' | 'BOV' | 'BRL' | 'BSD' | 'BTN' | 'BWP' | 'BYN' | 'BZD' | 'CAD' | 'CDF' | 'CHE' | 'CHF' | 'CHW' | 'CLF' | 'CLP' | 'CNY' | 'COP' | 'COU' | 'CRC' | 'CUC' | 'CUP' | 'CVE' | 'CZK' | 'DJF' | 'DKK' | 'DOP' | 'DZD' | 'EGP' | 'ERN' | 'ETB' | 'EUR' | 'FJD' | 'FKP' | 'GBP' | 'GEL' | 'GHS' | 'GIP' | 'GMD' | 'GNF' | 'GTQ' | 'GYD' | 'HKD' | 'HNL' | 'HRK' | 'HTG' | 'HUF' | 'IDR' | 'ILS' | 'INR' | 'IQD' | 'IRR' | 'ISK' | 'JMD' | 'JOD' | 'JPY' | 'KES' | 'KGS' | 'KHR' | 'KMF' | 'KPW' | 'KRW' | 'KWD' | 'KYD' | 'KZT' | 'LAK' | 'LBP' | 'LKR' | 'LRD' | 'LSL' | 'LYD' | 'MAD' | 'MDL' | 'MGA' | 'MKD' | 'MMK' | 'MNT' | 'MOP' | 'MRU' | 'MUR' | 'MVR' | 'MWK' | 'MXN' | 'MXV' | 'MYR' | 'MZN' | 'NAD' | 'NGN' | 'NIO' | 'NOK' | 'NPR' | 'NZD' | 'OMR' | 'PAB' | 'PEN' | 'PGK' | 'PHP' | 'PKR' | 'PLN' | 'PYG' | 'QAR' | 'RON' | 'RSD' | 'RUB' | 'RWF' | 'SAR' | 'SBD' | 'SCR' | 'SDG' | 'SEK' | 'SGD' | 'SHP' | 'SLL' | 'SOS' | 'SRD' | 'SSP' | 'STN' | 'SVC' | 'SYP' | 'SZL' | 'THB' | 'TJS' | 'TMT' | 'TND' | 'TOP' | 'TRY' | 'TTD' | 'TWD' | 'TZS' | 'UAH' | 'UGX' | 'USD' | 'USN' | 'UYI' | 'UYU' | 'UYW' | 'UZS' | 'VES' | 'VND' | 'VUV' | 'WST' | 'XAF' | 'XAG' | 'XAU' | 'XBA' | 'XBB' | 'XBC' | 'XBD' | 'XCD' | 'XDR' | 'XOF' | 'XPD' | 'XPF' | 'XPT' | 'XSU' | 'XTS' | 'XUA' | 'XXX' | 'YER' | 'ZAR' | 'ZMW' | 'ZWL' ``` Examples ### Examples * #### Track cash session closures ##### Description Subscribe to cash tracking session completion events to generate end-of-shift reports and reconcile cash handling. This example demonstrates logging session closures with session ID, opening time, and closing time, enabling audit trails, compliance notifications, and comprehensive cash management tracking. ##### React ```tsx import {reactEventExtension} from '@shopify/ui-extensions-react/point-of-sale'; export default reactEventExtension( 'pos.cash-tracking-session-complete.event.observe', (eventData) => { // Access session data from the event const {cashTrackingSessionComplete} = eventData; // Log session completion for audit trails console.log('Cash tracking session completed:', { sessionId: cashTrackingSessionComplete.id, openingTime: new Date(cashTrackingSessionComplete.openingTime).toISOString(), closingTime: new Date(cashTrackingSessionComplete.closingTime).toISOString(), }); // Example: Generate end-of-shift report // fetch('/api/cash-sessions/complete', { // method: 'POST', // body: JSON.stringify({ // sessionId: cashTrackingSessionComplete.id, // openingTime: cashTrackingSessionComplete.openingTime, // closingTime: cashTrackingSessionComplete.closingTime, // }), // }); // Return success (no errors) return {}; }, ); ``` ##### TS ```ts import {eventExtension} from '@shopify/ui-extensions/point-of-sale'; export default eventExtension( 'pos.cash-tracking-session-complete.event.observe', (eventData) => { // Access session data from the event const {cashTrackingSessionComplete} = eventData; // Log session completion for audit trails console.log('Cash tracking session completed:', { sessionId: cashTrackingSessionComplete.id, openingTime: new Date(cashTrackingSessionComplete.openingTime).toISOString(), closingTime: new Date(cashTrackingSessionComplete.closingTime).toISOString(), }); // Example: Generate end-of-shift report // fetch('/api/cash-sessions/complete', { // method: 'POST', // body: JSON.stringify({ // sessionId: cashTrackingSessionComplete.id, // openingTime: cashTrackingSessionComplete.openingTime, // closingTime: cashTrackingSessionComplete.closingTime, // }), // }); // Return success (no errors) return {}; }, ); ```