Cash Drawer API
The Cash Drawer API provides programmatic control over cash drawer hardware connected to POS devices. Use this API to trigger cash drawer operations for manual cash handling, custom payment workflows, or register management tasks.
Anchor to Use casesUse cases
- Manual operations: Open cash drawers for verification, deposits, or withdrawals outside transactions.
- Dual authorization: Implement workflows requiring manager approval before opening the drawer.
- Cash management: Create tools for end-of-shift counting, till balancing, or float changes.
- Compliance: Build features requiring cash drawer access logs or audit trails.
Anchor to PropertiesProperties
The shopify global object provides methods for controlling cash drawer hardware. Access the following properties on shopify to trigger cash drawer operations for manual cash handling.
- Anchor to openopenopen() => Promise<void>() => Promise<void>requiredrequired
Opens the connected cash drawer device. The drawer will automatically open if a compatible cash drawer is connected to the POS device. Use for manual cash drawer operations, implementing custom payment workflows, or providing explicit cash drawer access in register management interfaces.
Anchor to Best practicesBest practices
- Implement error handling: Wrap
cashDrawer.open()calls in try-catch blocks. Show clear error messages with resolution steps. - Require authorization: Implement authorization checks before opening for non-transaction operations. Consider PIN entry, manager approval, or staff permissions.
- Provide user feedback: Show immediate confirmations like "Cash drawer opened successfully" so staff know the operation completed.
- Log operations for audit: Track all openings including timestamps, staff info, and reason for loss prevention and compliance.
- Test without hardware: Handle scenarios where no drawer is connected with fallback workflows or clear messaging.
- Consider timing: Open at appropriate moments. Avoid opening multiple times in quick succession or in inappropriate workflow states.
Anchor to LimitationsLimitations
The API only triggers the drawer opening mechanism and cannot detect whether the drawer is currently open, closed, or physically jammed—your extension is responsible for any required state tracking.