# 초기화하기

Wepin PIN Pad Library를 초기화하는 방법입니다.

## init

Wepin PIN Pad Library 인스턴스를 생성하고 초기화 합니다.&#x20;

초기화시에 핀 패드 화면에 보여질 언어를 설정합니다.

```javascript
// 인스턴스 생성
const wepinPin = new WepinPin({
  appKey: 'your-wepin-app-key',
})
// 초기화
await wepinPin.init({
  defaultLanguage: 'ko',
})
```

### **Parameters**

* `defaultLanguage`: \<string>\
  핀 패드화면의 기본 언어 설정, 기본 값은 `'en'` 입니다. 현재 지원하는 언어는 `'ko'`, `'en'` ,`'ja'`입니다.

### **Return value**

* `Promise`\<void>

### Example

```javascript
// 인스턴스 생성
const wepinPin = new WepinPin({
  appKey: 'your-wepin-app-key',
})

or 

// 생성한 WepinLogin 인스턴스를 WepinPin에 전달
const wepinLogin = new WepinLogin()
const wepinPin = new WepinPin({
  appKey: 'your-wepin-api-key',
  wepinLogin,
})

```

```javascript
// 초기화
await wepinPin.init({
  defaultLanguage: 'ko',
})
```

그런 다음 [Wepin Login Library](https://docs.wepin.io/widget-integration/web-javascript-sdk/login-library) 로 위핀에 로그인 하세요.

```javascript
// 로그인 방식에 따라 필요한 로그인 메소드를 실행
const loginRes = await wepinPin.login.loginWithEmailAndPassword(...)
// Wepin에 로그인
await wepinPin.login.loginWepin(loginRes)
```

## isInitialized

Wepin PIN Pad Library가 정상적으로 초기화 되었는지 확인할 수 있습니다.&#x20;

```javascript
wepinPin.isInitialized()
```

### **Parameters**

* `<void>`

### **Return Value**

* `<boolean>`\
  초기화가 정상적으로 잘 된 경우 **true** , 실패한 경우 **false** 를 반환합니다.

### **Example**

```javascript
if(wepinPin.isInitialized()) {
  console.log('wepinPin is initialized!')
}
```

## changeLanguage <a href="#changelanguage" id="changelanguage"></a>

```javascript
wepinPin.changeLanguage(language)
```

핀 패드 화면에 표시되는 언어를 변경합니다. 현재 `'ko'`, `'en'`, `'ja'`만 지원됩니다.

### **Supported Version**

* 버전 <mark style="color:orange;">**`0.0.23`**</mark> 이상에서 지원.

### **Parameters**

* `language` \<string>

### **Return value** <a href="#return-value-1" id="return-value-1"></a>

* `<void>`

### Example <a href="#example-1" id="example-1"></a>

```javascript
wepinPin.changeLanguage("ko")
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.wepin.io/widget-integration/web-javascript-sdk/pin-pad-library/init.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
