Skip to content

UI API

POS 플러그인에서 제공하는 UI 컴포넌트 API입니다. 현재는 팝업 UI만 제공하며, 추후 다양한 UI 컴포넌트가 추가될 예정입니다.

Types

Barcode

바코드 스캔을 위한 UI 타입입니다.

ts
{
  type: 'barcode'; // UI 타입
  productName: string; // 상품명 (팝업 왼쪽 상단에 표시)
}
ts
{
    type: 'barcode';
    complete: true;
    data: {
        barcode: string;    // 스캔된 바코드 값
        result: 'SUCCESS';  // 성공 결과
    } | {
        result: 'CANCELLED'; // 사용자 취소
    };
}
ts
{
  type: 'barcode';
  complete: false;
  errorMessage: string; // 에러 메시지
}

Methods

openPopup

팝업 UI를 표시합니다.

바코드 스캔 팝업

ts
import { posPluginSdk } from '@tossplace/pos-plugin-sdk';

const result = await posPluginSdk.ui.openPopup({
  type: 'barcode',
  productName: '토스 POS 플러그인', // 팝업 왼쪽 상단에 표시
});

if (result.complete && result.data.result === 'SUCCESS') {
  console.log('스캔된 바코드:', result.data.barcode);
} else if (result.complete && result.data.result === 'CANCELLED') {
  console.log('사용자가 취소했습니다');
} else {
  console.error('스캔 실패:', result.errorMessage);
}