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


---

# 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/en/widget-integration/web-javascript-sdk/pin-pad-library/initialization.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.
