WEPIN Developer Documentation
WepinBlogContact
English
English
  • Get Started
    • Introduction
  • Wepin
    • Features
    • Architecture
      • Key Generation
      • Signing
      • Key Backup
    • Workspace
      • App Registration and Key Issuance
      • Networks and Assets Addition
      • Widget Design
    • Supported blockchains
    • Account Abstraction
  • login
    • Overview
    • Social Login Auth Providers
      • Email/Password
      • Google
      • Apple
      • Discord
      • Naver
      • Facebook
      • Line
      • Kakao
    • User Interface
    • Simplified Login
    • Resource
  • Widget Integration
    • Prerequisites
    • Web: JavaScript SDK
      • Login Library
        • Installation
        • Initialization
        • Methods
      • PIN Pad Library
        • Installation
        • Initialization
        • Methods
      • Widget
        • Installation
        • Initialization
        • Methods
        • Final Review
      • Provider
        • Ethereum Provider
        • Kaia Provider
        • Solana Provider
        • Wagmi Connector
      • Wallet Adapter
        • Solana Wallet Adapter
    • Android: Java & Kotlin SDK
      • Login Library
        • Installation
        • Initialization
        • Methods
      • PIN Pad Library
        • Installation
        • Initialization
        • Methods
      • Widget Library
        • Installation
        • Initialization
        • Methods
    • iOS: Swift SDK
      • Login Library
        • Installation
        • Initialization
        • Methods
      • PIN Pad Library
        • Installation
        • Initialization
        • Methods
      • Widget Library
        • installation
        • initialization
        • Methods
    • Flutter SDK
      • Login Library
        • Installation
        • Initialization
        • Methods
      • Widget
        • Installation
        • Initialization
        • Methods
        • Final Review
      • PIN Pad Library
        • Installation
        • Initialization
        • Methods
    • React Native SDK
      • Login Library
        • Installation
        • Initialization
        • Methods
    • Unity SDK
      • Installation
      • Initialization
      • Methods
      • Final Review
    • Compose Multiplatform SDK
      • Login Library
        • Installation
        • Initialization
        • Methods
      • Widget
        • Installation
        • Initialization
        • Methods
        • Final Review
  • API
    • Overview
    • Registration
    • Login
    • Wallet
    • Token and NFT
    • Transaction
  • Deprecated
    • Web: JavaScript SDK
      • SDK
        • Installation
        • Initialization
        • Methods
        • Final Review
      • Provider
        • EVM-Compatible Networks
      • Wagmi Connector
    • Android: Java & Kotlin SDK
      • Installation
      • Initialization
      • Methods
      • Final Review
    • iOS: Swift SDK
      • Installation
      • Initialization
      • Methods
      • Final Review
    • Flutter SDK
      • Installation
      • Initialization
      • Methods
      • Final Review
    • React Native SDK
      • Installation
      • Initialization
      • Methods
      • Final Review
      • Providers
        • Ethereum Providers
  • MISC
    • Logo & Brand
Powered by GitBook
On this page
  • init
  • isInitialized
  • Example

Was this helpful?

  1. Deprecated
  2. Web: JavaScript SDK
  3. SDK

Initialization

Here is how to initialize the Wepin Widget JavaScript SDK.

First, create a Wepin instance and initialize the instance using the App ID and App Key assigned after app registration.

init

Initialize the Wepin object through the init method. Assign the App ID and App SDK Key allocated during the app registration process at initialization. Additionally, define the properties of the widget that are needed.

const testAppId = 'app_id_eg12sf3491azgs520' // Test App ID
const testAppKey = 'ak_test_ghq1D5s1sfG234sbnhdsw24mnovk313' // Test App Key 
const attributes = {
  type: 'hide',
  defaultLanguage: 'ko',
  defaultCurrency : 'KRW',
  loginProviders: ['google', 'apple'],
}

const wepin = await Wepin.init( 
  testAppId,
  testAppKey,
  attributes
)

The parameters for init are as follows.

  • appId: String App ID assigned during registration

  • appKey: String App Key assigned during registration

  • attributes: Object (optional) Properties of the Wepin Widget

    • type: String The type of display of widget as Wepin is initiated. The default value is hide. show: Show the widget window immediately after loading for the first time. hide: Hide the widget window initially when loading and show it later using openWindow().

    • defaultLanguage: String The language to be displayed on the widget. The default value is ko. The currently supported languages are en and ko.

    • defaultCurrency: String The currency to be displayed on the widget. The default value is KRW. The currently supported currencies are USD and KRW.

    • loginProviders: [String] Here is the list of login providers: google, apple, naver, and discord. Define and use only the necessary login providers. If you do not specify this value, all the four providers can be used by default.

      • The loginProviders parameter is supported from @wepin/types version v0.0.11 or higher.

isInitialized

You can use isInitialized to check if the Wepin object has been successfully initialized.

The returned value is as follows.

  • boolean init result; true if Wepin SDK is already initialized, otherwise false.

Example

const testAppId = 'app_id_eg12sf3491azgs520' // Test App ID
const testAppKey = 'ak_test_ghq1D5s1sfG234sbnhdsw24mnovk313' // Test App Key 
const attributes = {
  type: 'hide',
  defaultLanguage: 'ko',
  defaultCurrency : 'KRW',
}

const wepin = await Wepin.init( 
  testAppId,
  testAppKey,
  attributes
)
if(wepin.isInitialized()) {
  console.log('wepin is initialized!')
}
PreviousInstallationNextMethods

Last updated 9 months ago

Was this helpful?