# Initialization

Here is the instructions on how to initialize the Wepin PIN Pad Library.

## init

To create and initialize an instance of the Wepin PIN Pad Library, set the language to be displayed on the PIN pad screen during initialization.

```javascript
// Create instance
const wepinPin = new WepinPin({
  appKey: 'your-wepin-app-key',
})
// Initialize
await wepinPin.init({
  defaultLanguage: 'ko',
})

```

### **Parameters**

* `defaultLanguage`: \<string>\
  It sets the default language of the widget. The default value is `'ko'`. Currently supported languages are `'ko'`, `'en'`and `'ja'`

### **Return value**

* `Promise`\<void>

### Example

```javascript
// Create instance
const wepinPin = new WepinPin({
  appKey: 'your-wepin-app-key',
})

or 

// Pass the created WepinLogin instance to WepinPin
const wepinLogin = new WepinLogin()
const wepinPin = new WepinPin({
  appKey: 'your-wepin-api-key',
  wepinLogin,
})

```

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

Then, log in to Wepin using the [Wepin Login Library](https://docs.wepin.io/en/widget-integration/web-javascript-sdk/login-library).

```javascript
// Execute the required login method based on the login method
const loginRes = await wepinPin.login.loginWithEmailAndPassword(...)
// Log in to Wepin
await wepinPin.login.loginWepin(loginRes)
```

## isInitialized&#x20;

It checks if the Wepin PIN Pad Library is initialized properly.

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

### **Parameters**

* `<void>`

### **Return Value**

* `<boolean>`\
  It returns **true** if init was successful, otherwise returns **false**.

### **Example**

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

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

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

Changes the language displayed on the PIN pad screen. Currently, only `'ko'`, `'en'`, and `'ja'` are supported.

### **Supported Version**

* Supported from version <mark style="color:orange;">**`0.0.23`**</mark> and later.

### **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")
```
