# 초기화하기

## **Import SDK**

Wepin React Native Widget SDK를 사용하기 위해 먼저 SDK를 가져와야 합니다.&#x20;

다음과 같이 import 문을 추가합니다.

```javascript
import WepinWidgetSDK from '@wepin/sdk-rn';
```

## WepinWidgetSDK Instance 생성 <a href="#creating-the-wepinwidgetsdk-instance" id="creating-the-wepinwidgetsdk-instance"></a>

`WepinWidgetSDK` 인스턴스를 생성하기 전에 위핀 워크스페이스에서 Android/iOS 관련 앱 정보를 등록해야 합니다.

{% content-ref url="/pages/cfg4nwJBI8VfiJpH4EW8" %}
[앱 등록 및 키 발급](/wepin/workspace/app-registration-and-key-issuance.md)
{% endcontent-ref %}

등록한 앱 정보를 바탕으로 다음과 같이 `WepinWidgetSDK` 인스턴스를 생성합니다.&#x20;

```javascript
const wepinWidget = new WepinWidgetSDK({
  appId: 'wepinAppId',
  appKey: 'wepinAppKey',
});
```

## init

`Wepin React Native Widget SDK`를 초기화할 때, 필요한 위젯 속성들을 정의할 수 있습니다.

```javascript
await wepinWidget.init();
```

#### **Parameters**

* **attributes** `<IWepinSDKAttributes>` ***optional*****&#x20;-** 초기화 시 정의할 위젯 속성들입니다
  * defaultLanguage`<String>`\
    위젯의 기본 언어 설정. 기본 값은 `ko`이며, 현재 지원하는 언어는 `en`, `ko` 두 가지입니다.
  * **defaultCurrency** `<String>`\
    위젯의 기본 통화 설정. 기본 값은 `KRW`이며, 현재 지원하는 통화는 `USD`, `KRW` 두 가지입니다.

#### **Example**

```javascript
await wepinWidget.init();
```

## isInitialized

`WepinWidgetSDK`가 정상적으로 초기화되었는지 확인할 수 있습니다.

```javascript
wepinWidget.isInitialized();
```

#### **Parameters**

* None

#### **Return Value**

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

## changeLanguage

위젯의 언어와 통화를 변경할 수 있습니다.

```javascript
await wepinWidget.changeLanguage({ language, currency });
```

#### **Parameters**

* **\<object>**
  * **language** `<String>`\
    위젯에 표시될 언어를 지정합니다. 현재 지원하는 언어는 `en`, `ko` , `ja` 세 가지 입니다.
  * **currency** `<String>`\
    위젯에 표시될 통화를 지정합니다. 현재 지원하는 통화는 `USD`, `KRW, JPY` 세  가지 입니다.


---

# 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/react-native-sdk/widget/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.
