✨ V2의 새로운 기능
- Axim Pay 자동 연동 (외부 지갑 간편 결제)
- Vue 기반 입금 UI (향상된 UX)
- 연결 상태 자동 로드 및 관리
- 완전히 독립적인 SDK (V1 import 없음)
Widget Demo V2 프로젝트 다운로드

완전한 예제 코드와 파트너 서버 구현이 포함되어 있습니다


1. V2 신규 기능 소개

🔗

Axim Pay 자동 연동

초기화 시 자동으로 Axim 정보를 로드하고 위젯에 전달합니다.

  • 자동 활성화 여부 감지
  • 연결 상태 자동 로드
  • URL 파라미터 자동 추가
🎨

하이브리드 UI

입금은 Vue, 출금은 안정적인 HTML을 사용합니다.

  • 입금: Vue 앱 (/payments)
  • 출금: withdrawal.html
  • 완벽한 호환성
📊

향상된 이벤트 시스템

Axim 관련 이벤트가 추가되었습니다.

  • 연결/결제 이벤트
  • 상태 변경 이벤트
  • 에러 핸들링
🚀

완전히 독립적

V1을 import하지 않는 독립 SDK입니다.

  • 2,000줄 완전 구현
  • 31KB 최적화
  • V1과 100% 호환

2. 설치 및 로드 방법

📍 현재 배포 경로
https://widget.cryptoments.net/src/v2/widget.cryptoments.sdk.js

이 경로가 현재 프로덕션에서 사용 중인 V2 SDK 경로입니다.

2.1. CDN 방식 (프로덕션)

<!-- V2 SDK (현재 배포 경로) -->
<script src="https://widget.cryptoments.net/src/v2/widget.cryptoments.sdk.js"></script>

<!-- 또는 압축 버전 -->
<script src="https://widget.cryptoments.net/src/v2/widget.cryptoments.sdk.min.js"></script>

2.2. ES 모듈 방식

import { CryptoPaymentsWidget } from './v2/widget.cryptoments.sdk.js';
// 또는
import CryptoPaymentsWidget from './v2/widget.cryptoments.sdk.js';
💡 권장사항: 프로덕션에서는 CDN 방식을 사용하고, 특정 버전을 명시하는 것을 권장합니다.

3. 빠른 시작

3.1. 기본 사용법

// 1. SDK 생성
const widget = new CryptoPaymentsWidget({
  apiBaseUrl: 'https://api.cryptoments.net',
  widgetBaseUrl: 'https://widget.cryptoments.net',
  partnerApiUrl: '/api/get-widget-token',
  mode: 'modal',
});

// 2. 초기화 (Axim 정보 자동 로드)
await widget.initialize('user-12345');

// 3. Axim 활성화 확인
if (widget.isAximEnabled()) {
  console.log('✅ Axim Pay 사용 가능');
  console.log('Axim 정보:', widget.getAximInfo());
  console.log('연결 상태:', widget.getAximConnectionStatus());
}

// 4. 입금 위젯 열기
await widget.openDeposit('user-12345', {
  presetAmount: 10
});

// 5. 출금 위젯 열기
await widget.openWithdrawal('user-12345', {
  maxAmount: 100000, //사용자 잔액
  //필수
  reqWithdraw: async (data) => {
    // 출금 처리
    const response = await fetch('/api/withdraw', {
      method: 'POST',
      body: JSON.stringify(data)
    });
    return response.ok;
  }
});

3.2. 전역 객체 사용

<script src="https://widget.cryptoments.net/src/v2/widget.cryptoments.sdk.js"></script>

<script>
  // 전역 객체 사용
  const widget = new window.CryptomentsWidget({
    apiBaseUrl: 'https://api.cryptoments.net',
    mode: 'modal'
  });

  // 버전 확인
  console.log('SDK Version:', window.CryptomentsWidget.version); // "v2.0.0"
</script>

4. 설정 옵션

4.1. 기본 설정

옵션 타입 기본값 설명
apiBaseUrl string 'https://api.cryptoments.net' Widget API 서버 주소
widgetBaseUrl string 'https://widget.cryptoments.net' 위젯 UI 서버 주소 (Vue 앱)
partnerApiUrl string '/api/get-widget-token' 파트너 서버의 토큰 발급 API
mode string 'window' 위젯 표시 모드: 'window' | 'modal'
theme string 'light' 테마: 'light' | 'dark' (추후 예정)
language string 'ko' 언어: 'ko' | 'en' | 'ja' (추후 예정)
width number 450 위젯 너비 (픽셀)
height number 800 위젯 높이 (픽셀)
debug boolean false 디버그 모드 활성화

4.2. 입금 위젯 옵션

옵션 타입 기본값 설명
chainType string null 기본 체인
( 'BSC' | 'TRON' | 'POLYGON' )
currencyType string null 기본 통화
( 'USDT' | 'USDC' )
presetAmount number null 기본 금액
presetAmountCurrency string USD 기본 금액의 통화
( 'KRW' | 'USD' )
minAmount number 10 최소 입력 금액 (USD)
maxAmount number 100000 최대 입력 금액 (USD)
allowAmountEdit boolean true 금액 수정 허용 여부
fixedRateKrw number null 고정 된 환율 (KRW)
skipInput boolean false 입력 UI 스킵
(*presetAmount, *currencyType, chainType 같이 쓰면 고정)
allowedCurrencies array ['USDT', 'USDC'] 허용 통화 목록
['USDT', 'USDC']
amountOptions array [10000, 50000, 100000, 500000] 금액별(krw) 옵션: [10000, 50000, 100000, 500000],

4.3. 출금 위젯 옵션

옵션 타입 기본값 설명
chainType string null 기본 체인
( 'BSC' | 'TRON' | 'POLYGON' )
currencyType string null 기본 통화
( 'USDT' | 'USDC' )
presetAmount number null 기본 금액
presetAmountCurrency string USD 기본 금액의 통화
( 'KRW' | 'USD' )
minAmount number 10 최소 입력 금액 (USD)
maxAmount number 100000 최대 입력 금액 (USD - 사용자 잔액 표기)
allowAmountEdit boolean true 금액 수정 허용 여부
fixedRateKrw number null 고정 된 환율 (KRW)
skipInput boolean false 입력 UI 스킵
(*presetAmount, *currencyType, chainType 같이 쓰면 고정)
allowedCurrencies array ['USDT', 'USDC'] 허용 통화 목록
['USDT', 'USDC']
reqWithdraw function null *필수* 출금 요청 처리 함수
showBalance boolean true 잔액 정보 표시 여부

4.4. 옵션 예제


// 1. KRW 환율 고정시
await widget.openDeposit('user-12345', {
  fixedRateKrw: 1500
});
await widget.openWithdrawal('user-12345', {
    fixedRateKrw: 1500,

    maxAmount: 100000, //사용자 잔액
    reqWithdraw: async (data) => { //필수
        // 출금 처리
        const response = await fetch('/api/withdraw', {
        method: 'POST',
        body: JSON.stringify(data)
        });
        return response.ok;
    }
});


// 2. 고정값 입금/출금시  
await widget.openDeposit('user-12345', {
    skipInput:true,
    presetAmount:100,//필수
    currencyType:'USDT',//필수
    chainType:'TRON'//선택 (미설정시 사용자가 직접 변경 가능)
});
await widget.openWithdrawal('user-12345', {
    skipInput:true,
    presetAmount:100,//필수
    currencyType:'USDT',//필수
    chainType:'TRON'//선택 (미설정시 사용자가 직접 변경 가능)

    maxAmount: 100000, //사용자 잔액
    reqWithdraw: async (data) => { //필수
        // 출금 처리
        const response = await fetch('/api/withdraw', {
        method: 'POST',
        body: JSON.stringify(data)
        });
        return response.ok;
    }
});

// 3. 금액 입력만 고정
await widget.openDeposit('user-12345', {
    presetAmount:100,
    allowAmountEdit:false
});
await widget.openWithdrawal('user-12345', {
    presetAmount:100,
    allowAmountEdit:false

    maxAmount: 100000, //사용자 잔액
    reqWithdraw: async (data) => { //필수
        // 출금 처리
        const response = await fetch('/api/withdraw', {
        method: 'POST',
        body: JSON.stringify(data)
        });
        return response.ok;
    }
});

5. 주요 메서드

5.1. 초기화

// V2는 초기화 시 자동으로 Axim 정보를 로드합니다
await widget.initialize('user-12345');

// 초기화 후 Axim 정보 확인
console.log('Axim 활성화:', widget.isAximEnabled());
console.log('Axim 정보:', widget.getAximInfo());
console.log('연결 상태:', widget.getAximConnectionStatus());

5.2. 입금 위젯 열기

// 기본 입금
await widget.openDeposit('user-12345');

// 옵션 지정
await widget.openDeposit('user-12345', {
  chainType: 'BSC',
  currencyType: 'USDT',
  presetAmount: 100000
});

5.3. 출금 위젯 열기

await widget.openWithdrawal('user-12345', {
  minAmount: 10,
  maxAmount: 100000,
  showBalance: true,
  
  // 필수: 출금 요청 처리 함수
  reqWithdraw: async (withdrawalData) => {
    console.log('출금 요청:', withdrawalData);
    
    // 파트너 서버에 출금 요청
    const response = await fetch('/api/withdraw', {
      method: 'POST',
      headers: { 'Content-Type': 'application/json' },
      body: JSON.stringify(withdrawalData)
    });
    
    return response.ok; // 성공 시 true 반환
  },
  
  // 선택: 성공 콜백
  onSuccess: (result) => {
    console.log('출금 성공:', result);
  },
  
  // 선택: 에러 콜백
  onError: (error) => {
    console.error('출금 실패:', error);
  }
});

5.4. V2 신규 메서드 NEW

// Axim 활성화 여부
const enabled = widget.isAximEnabled();

// Axim 정보 조회
const info = widget.getAximInfo();
// { siteId: '12345', connectId: '1_user123', ... }

// Axim 연결 상태 조회 (캐시)
const status = widget.getAximConnectionStatus();

// Axim 연결 상태 확인 (API 호출)
const latestStatus = await widget.checkAximConnectionStatus();

// Axim 정보 새로고침
await widget.refreshAximInfo();

// SDK 버전 확인
const version = widget.getVersion(); // "v2.0.0"

// 디버그 정보
const debugInfo = widget.getDebugInfo();
widget.printDebugInfo(); // 콘솔 출력

6. Axim Pay 연동 NEW

6.1. Axim이란?

🔗 Axim Pay
외부 지갑(메타마스크, WalletConnect 등)을 연결하여 간편하게 결제할 수 있는 서비스입니다. 사용자는 입금 주소를 복사하지 않고도, 연결된 지갑에서 바로 결제할 수 있습니다.

6.2. Axim 초기화 플로우

sequenceDiagram participant Partner as 파트너 사이트 participant SDK as Widget SDK participant API as Widget API Partner->>SDK: initialize('user-123') SDK->>API: GET /axim/init-info API->>SDK: { enabled, siteId, connectId, ... } SDK->>API: GET /axim/connection-status API->>SDK: { isConnected, walletAddress, ... } SDK->>Partner: 초기화 완료 Note over Partner: widget.isAximEnabled() Note over Partner: widget.getAximInfo() Note over Partner: widget.getAximConnectionStatus()

6.3. Axim 이벤트 처리

// Axim 활성화 이벤트
widget.addEventListener('aximEnabled', (event) => {
  console.log('✅ Axim Pay 활성화:', event.data);
  // UI에 Axim Pay 옵션 표시
  showAximPayOption();
});

// Axim 연결 성공 이벤트
widget.addEventListener('aximConnectionSuccess', (event) => {
  console.log('🎉 Axim 지갑 연결 성공:', event.data);
  // 연결 정보 저장
  saveAximConnection({
    connectId: event.data.connectId,
    walletAddress: event.data.walletAddress
  });
  // UI 업데이트
  showConnectedWallet(event.data.walletAddress);
});

// Axim 결제 성공 이벤트
widget.addEventListener('aximPaymentSuccess', (event) => {
  console.log('💰 Axim 결제 완료:', event.data);
  // 결제 정보 저장
  savePayment({
    txHash: event.data.txHash,
    amount: event.data.amount,
    currency: event.data.currency
  });
  // 성공 페이지로 이동
  location.href = `/success?tx=${event.data.txHash}`;
});

6.4. Axim 이벤트 플로우

1
Widget UI: Axim 연결 API 호출
POST /widgets/axim/connect → requestId 반환
2
Widget UI: Status 폴링 시작
GET /widgets/axim/connect-status (2초마다)
3
Widget UI: 상태 변경 감지
PENDING → CONNECTED 감지
4
Widget UI → SDK: postMessage 전송
AXIM_CONNECTION_SUCCESS 메시지
5
SDK: 이벤트 발생
emit('aximConnectionSuccess', data)
6
파트너 사이트: 이벤트 처리
addEventListener()로 등록한 콜백 실행
🔒 중요: SDK는 Axim API를 직접 호출하지 않습니다. Widget UI가 API 호출 및 폴링을 담당하고, SDK는 Widget UI로부터 받은 메시지를 파트너 사이트에 전달하는 중개자 역할만 수행합니다.

7. 이벤트 시스템

7.1. 기본 이벤트

이벤트 발생 시점 데이터
depositCompleted 입금 주소 생성 완료 address, chainType, currencyType
withdrawalCompleted 출금 요청 완료 transactionId, amount, currency
error 에러 발생 error, message
close 위젯 닫힘 -
ready 위젯 준비 완료 widgetType

7.2. Axim 이벤트 NEW

이벤트 발생 시점 데이터
aximEnabled Axim 활성화 감지 siteId, connectId, status
aximConnectionRequested Axim 연결 시작 -
aximConnectionSuccess Axim 지갑 연결 성공 connectId, walletAddress, connectWalletToken
aximConnectionFailed Axim 지갑 연결 실패 error
aximPaymentRequested Axim 결제 요청 amount, currency
aximPaymentSuccess Axim 결제 성공 txHash, amount, currency, paymentId
aximPaymentFailed Axim 결제 실패 error
aximDisconnected Axim 연결 해제 -

7.3. 이벤트 리스너 등록

// 개별 이벤트 리스너
widget.addEventListener('aximPaymentSuccess', (event) => {
  console.log('결제 완료:', event.data);
});

// 여러 이벤트 일괄 등록
const listenerIds = widget.addEventListeners({
  aximConnectionSuccess: (event) => {
    console.log('연결 성공:', event.data);
  },
  aximPaymentSuccess: (event) => {
    console.log('결제 성공:', event.data);
  },
  error: (event) => {
    console.error('에러:', event.data);
  }
});

// 이벤트 리스너 제거
widget.removeEventListener('aximPaymentSuccess', listenerId);

// 모든 이벤트 리스너 제거
widget.removeAllEventListeners();

8. 파트너 서버 연동

8.1. 토큰 발급 API 구현

// Node.js/Express 예시
app.post('/api/get-widget-token', async (req, res) => {
  const { partnerUserId, permissions } = req.body;
  
  // 1. 서명 생성
  const timestamp = Math.floor(Date.now() / 1000);
  const method = 'POST';
  const path = '/widgets/auth/token';
  const message = method + path + timestamp;
  const signature = crypto
    .createHmac('sha256', PARTNER_API_SECRET)
    .update(message)
    .digest('hex');
  
  // 2. Widget API 호출
  const response = await fetch('https://api.cryptoments.net/widgets/auth/token', {
    method: 'POST',
    headers: {
      'Content-Type': 'application/json',
      'X-API-KEY': PARTNER_API_KEY,
      'X-TIMESTAMP': timestamp,
      'X-SIGNATURE': signature
    },
    body: JSON.stringify({
      partnerUserId,
      permissions
    })
  });
  
  const data = await response.json();
  res.json({ accessToken: data.accessToken });
});

8.2. 출금 요청 처리

// reqWithdraw 함수 구현 예시
async function handleWithdraw(withdrawalData) {
  try {
    // 1. 사용자 검증
    const user = await getUserById(withdrawalData.userId);
    if (!user) {
      throw new Error('사용자를 찾을 수 없습니다');
    }
    
    // 2. 잔액 확인
    const balance = await getUserBalance(user.id, withdrawalData.currencyType);
    if (balance < withdrawalData.amountCrypto) {
      throw new Error('잔액이 부족합니다');
    }
    
    // 3. 출금 요청 저장
    const withdrawal = await createWithdrawalRequest({
      userId: user.id,
      chainType: withdrawalData.chainType,
      currencyType: withdrawalData.currencyType,
      toAddress: withdrawalData.toAddress,
      amount: withdrawalData.amountCrypto,
      status: 'PENDING'
    });
    
    // 4. 성공 응답
    return true;
    
  } catch (error) {
    console.error('출금 처리 실패:', error);
    return false;
  }
}

9. 예시 코드

9.1. 완전한 통합 예시

파트너 웹사이트 통합 코드

<!DOCTYPE html>
<html>
<head>
  <title>암호화폐 결제</title>
  <script src="https://widget.cryptoments.net/src/v2/widget.cryptoments.sdk.js"></script>
</head>
<body>
  <button id="depositBtn">입금하기</button>
  <button id="withdrawBtn">출금하기</button>
  <div id="axim-status"></div>
  
  <script>
    // SDK 생성
    const widget = new window.CryptomentsWidget({
      apiBaseUrl: 'https://api.cryptoments.net',
      widgetBaseUrl: 'https://widget.cryptoments.net',
      partnerApiUrl: '/api/get-widget-token',
      mode: 'modal',
      debug: true
    });

    // Axim 이벤트 리스너
    widget.addEventListener('aximEnabled', (event) => {
      console.log('Axim 활성화:', event.data);
      document.querySelector('#axim-status').textContent = 'Axim Pay 사용 가능';
    });

    widget.addEventListener('aximConnectionSuccess', (event) => {
      console.log('Axim 연결 성공:', event.data);
      alert(`지갑 연결 완료: ${event.data.walletAddress}`);
    });

    widget.addEventListener('aximPaymentSuccess', (event) => {
      console.log('Axim 결제 성공:', event.data);
      
      // 결제 정보 저장
      fetch('/api/save-payment', {
        method: 'POST',
        headers: { 'Content-Type': 'application/json' },
        body: JSON.stringify(event.data)
      });
      
      // 성공 페이지 이동
      location.href = '/payment-success';
    });

    // 입금 버튼
    document.getElementById('depositBtn').addEventListener('click', async () => {
      await widget.initialize('user-12345');
      await widget.openDeposit('user-12345', {
        presetAmount: 10
      });
    });

    // 출금 버튼
    document.getElementById('withdrawBtn').addEventListener('click', async () => {
      await widget.initialize('user-12345');
      await widget.openWithdrawal('user-12345', {
        minAmount: 10,
        maxAmount: 100000,
        reqWithdraw: async (data) => {
          const response = await fetch('/api/withdraw', {
            method: 'POST',
            headers: { 'Content-Type': 'application/json' },
            body: JSON.stringify(data)
          });
          return response.ok;
        }
      });
    });
  </script>
</body>
</html>

9.2. React 통합 예시

React Hook으로 위젯 관리

import { useState, useEffect, useCallback } from 'react';

function useCryptoWidget() {
  const [widget, setWidget] = useState(null);
  const [aximEnabled, setAximEnabled] = useState(false);
  
  useEffect(() => {
    const widgetInstance = new window.CryptomentsWidget({
      mode: 'modal',
      debug: true
    });
    
    // Axim 이벤트 리스너
    widgetInstance.addEventListener('aximEnabled', (event) => {
      setAximEnabled(true);
    });
    
    widgetInstance.addEventListener('aximPaymentSuccess', (event) => {
      // 결제 성공 처리
      handlePaymentSuccess(event.data);
    });
    
    setWidget(widgetInstance);
    
    return () => {
      widgetInstance.cleanup();
    };
  }, []);
  
  const openDeposit = useCallback(async (userId) => {
    if (!widget) return;
    await widget.initialize(userId);
    await widget.openDeposit(userId);
  }, [widget]);
  
  const openWithdrawal = useCallback(async (userId) => {
    if (!widget) return;
    await widget.initialize(userId);
    await widget.openWithdrawal(userId, {
      reqWithdraw: handleWithdraw
    });
  }, [widget]);
  
  return {
    widget,
    aximEnabled,
    openDeposit,
    openWithdrawal
  };
}

// 사용
function PaymentComponent() {
  const { aximEnabled, openDeposit, openWithdrawal } = useCryptoWidget();
  
  return (
    <div>
      {aximEnabled && <div>✅ Axim Pay 사용 가능</div>}
      <button onClick={() => openDeposit('user-123')}>입금</button>
      <button onClick={() => openWithdrawal('user-123')}>출금</button>
    </div>
  );
}

9.3. Vue 통합 예시

Vue Composable로 위젯 관리

// composables/useCryptoWidget.js
import { ref, onMounted, onUnmounted } from 'vue';

export function useCryptoWidget() {
  const widget = ref(null);
  const aximEnabled = ref(false);
  const aximInfo = ref(null);
  
  onMounted(() => {
    widget.value = new window.CryptomentsWidget({
      mode: 'modal',
      debug: true
    });
    
    // 이벤트 리스너
    widget.value.addEventListener('aximEnabled', (event) => {
      aximEnabled.value = true;
      aximInfo.value = event.data;
    });
    
    widget.value.addEventListener('aximPaymentSuccess', (event) => {
      handlePaymentSuccess(event.data);
    });
  });
  
  onUnmounted(() => {
    if (widget.value) {
      widget.value.cleanup();
    }
  });
  
  const openDeposit = async (userId) => {
    await widget.value.initialize(userId);
    await widget.value.openDeposit(userId);
  };
  
  return {
    widget,
    aximEnabled,
    aximInfo,
    openDeposit
  };
}

10. V1에서 마이그레이션

10.1. 변경사항 요약

항목 V1 V2
파일명 widget.cryptoments.js widget.cryptoments.sdk.js
CDN 경로 /src/widget.cryptoments.js /src/v2/widget.cryptoments.sdk.js
입금 UI deposit.html Vue 앱 (/payments)
출금 UI withdrawal.html Vue 앱 (/withdrawal)
Axim 연동 ❌ 없음 ✅ 자동 연동
API 호환성 - 100% 호환

11. 시스템 아키텍처

11.1. 전체 구조

graph TB A[파트너 웹사이트] -->|SDK 로드| B[Widget SDK V2] B -->|입금| C[Vue 앱
/payments] B -->|출금| D[withdrawal.html] C -->|API 호출| E[Widget API] D -->|API 호출| E C -->|postMessage| B D -->|postMessage| B E -->|Axim 연동| F[Axim Pay] style A fill:#e8f5e9,stroke:#4caf50,stroke-width:2px style B fill:#e3f2fd,stroke:#2196f3,stroke-width:2px style C fill:#f3e5f5,stroke:#9c27b0,stroke-width:2px style D fill:#fff3e0,stroke:#ff9800,stroke-width:2px style E fill:#fce4ec,stroke:#e91e63,stroke-width:2px style F fill:#e1f5fe,stroke:#00bcd4,stroke-width:2px

11.2. Axim 연결 플로우

sequenceDiagram participant PS as 파트너 사이트 participant SDK as Widget SDK participant UI as Widget UI participant API as Widget API PS->>SDK: initialize('user-123') SDK->>API: GET /axim/init-info API-->>SDK: { enabled, siteId, ... } SDK->>API: GET /axim/connection-status API-->>SDK: { isConnected, ... } SDK-->>PS: 초기화 완료 PS->>SDK: openDeposit() SDK->>UI: 위젯 열기 (Axim 파라미터 포함) Note over UI: 사용자가 "Axim 연결" 클릭 UI->>SDK: postMessage: AXIM_CONNECTION_REQUESTED SDK->>PS: emit('aximConnectionRequested') UI->>API: POST /axim/connect API-->>UI: { requestId } loop Status 폴링 (2초마다) UI->>API: GET /axim/connect-status API-->>UI: { status: 'PENDING' } end API-->>UI: { status: 'CONNECTED' } UI->>SDK: postMessage: AXIM_CONNECTION_SUCCESS SDK->>PS: emit('aximConnectionSuccess')

12. 문제 해결

12.1. 일반적인 문제

Q: Axim 정보가 로드되지 않아요

A: 다음을 확인하세요:
1. 위젯 토큰이 올바르게 발급되었는지 확인
2. 파트너의 Axim 설정이 활성화되어 있는지 확인
3. widget.isAximEnabled()로 상태 확인
4. 디버그 모드를 켜서 로그 확인: debug: true
Q: 위젯이 열리지 않아요

A: 다음을 확인하세요:
1. 팝업 차단 해제 (window 모드인 경우)
2. widget.isInitialized 확인
3. 콘솔에서 에러 메시지 확인
4. widget.printDebugInfo()로 상태 확인

12.2. 디버깅 팁

// 디버그 모드 활성화
const widget = new CryptoPaymentsWidget({
  debug: true
});

// 디버그 정보 출력
widget.printDebugInfo();

// 이벤트 히스토리 확인
const history = widget.getEventHistory();
console.log('이벤트 히스토리:', history);

// 이벤트 통계
const stats = widget.getEventStats();
console.log('이벤트 통계:', stats);

13. Demo Project

Widget Demo V2 프로젝트 다운로드

즉시 실행 가능한 완전한 데모 프로젝트 (Express 서버 + 예제 코드 포함)

13.1. 빠른 시작

# 1. 다운로드한 파일 압축 해제
unzip widget-demo-v2.zip

# 2. Demo Project 실행
cd widget-demo
npm install
npm start

# 3. 브라우저에서 V2 예시 테스트
http://localhost:3001/v2-examples

# 또는 V1 예시
http://localhost:3001/usage-examples

13.2. Demo Project 구조

widget-demo/
├── server.js                # Express 파트너 서버
├── usage-examples.html      # V1 SDK 사용 예시
├── v2-examples.html      # V2 SDK 사용 예시
└── package.json             # 의존성
💡 Demo Project 활용:
- V2 SDK의 모든 기능 테스트
- Axim Pay 연동 테스트
- 토큰 발급 로직 참고
- 실제 연동 코드 템플릿

14. 빌드된 파일

파일 용도 크기
widget.cryptoments.js v1 개발/디버깅 46KB
widget.cryptoments.min.js v1 프로덕션 24KB
widget.cryptoments.min.js.gz v1 프로덕션 Gzip 6.8KB
widget.cryptoments.sdk.js v2 개발/디버깅 55KB
widget.cryptoments.sdk.min.js v2 프로덕션 29KB
widget.cryptoments.sdk.min.js.gz v2 프로덕션 Gzip 7.7KB

15. 지원

📞 문의 및 지원

이메일: [email protected]
문서: https://docs.cryptoments.net
GitHub: https://github.com/cryptoments/widget-sdk
API 문서: Widget API Documentation
🎉 V2 SDK로 업그레이드하세요!
Axim Pay 연동으로 더 나은 사용자 경험을 제공하세요.
기존 V1 코드는 그대로 동작하며, 새로운 기능만 선택적으로 활용할 수 있습니다.