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
  • Parameters
  • Return value
  • Example
  • isInitialized
  • Parameters
  • Return Value
  • Example
  • changeLanguage
  • Parameters
  • Example

Was this helpful?

  1. Widget Integration
  2. Web: JavaScript SDK
  3. Widget

Initialization

Here is the instructions on how to initialize the Wepin Widget Javascript SDK.

init

It initializes the Wepin SDK. Defines the attributes needed for the widget during initialization.

await wepinSdk.init(attributes?)

Parameters

  • attributes <object> optional

  • type <string> It determines how to display the app widget window on the first load. The default value is hide. Currently, only hide is supported. hide hides the widget window on the first load. The widget window can be displayed later using openWindow().

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

  • defaultCurrency: <string> It sets the default currency of the widget. The default value is KRW. Currently, supported currencies are USD, KRW and JPY

  • loginProviders: <string[]> optional It's the list of login providers. Currently, supported providers are google, apple, naver, and discord. Define only the necessary login providers.

    • If this value is not specified, all provided providers can be used.

    • If an empty array is provided, only email login is available. (Supported from version v0.0.3)

Return value

  • Promise<void>

Example

await wepinSdk.init({
    type: 'hide',
    defaultLanguage: 'ko',
    defaultCurrency: 'KRW',
})

// google, apple login
await wepinSdk.init({
    type: 'hide',
    defaultLanguage: 'ko',
    defaultCurrency: 'KRW',
    loginProviders: ['google', 'apple']
})

// only email login
await wepinSdk.init({
    type: 'hide',
    defaultLanguage: 'ko',
    defaultCurrency: 'KRW',
    loginProviders: []
})

isInitialized

It checks if WepinSDK is initialized properly.

wepinSdk.isInitialized()

Parameters

  • <void>

Return Value

  • <boolean> It returns true if init was successful, otherwise returns false.

Example

await wepinSdk.init({
    type: 'hide',
    defaultLanguage: 'ko',
    defaultCurrency: 'KRW',
})

if(wepinSdk.isInitialized()) {
  console.log('wepinSDK is initialized!')
}

changeLanguage

It allows changing the language and currency of the widget.

wepinSdk.changeLanguage({language, currency})

Parameters

  • language <string> It specifies the language to be displayed in the widget. Currently, supported languages are en, ko and ja.

  • currency <string> It specifies the currency to be displayed in the widget. Currently, supported currencies are USD , KRW and JPY

Example

wepinSdk.changeLanguage({
   currency: 'KRW',
   language: 'ko'
})

PreviousInstallationNextMethods

Last updated 7 months ago

Was this helpful?