API Docs for: 1.0.2
Show:

KlarnaOnDemand Class

Manages application-wide settings and allows access to the SDK's views.

Methods

openPreferencesView

(
  • userToken
  • onError
  • [locale='en']
)

Presents the preferences view in an iframe that covers the entirety of the current document.

Parameters:

  • userToken String

    The token of the user whose preferences are to be changed.

  • onError Function

    A callback that will be activated if an error occurs while setting the user's preferences. This callback will be passed an error code related to the error. This code should not be presented to the user and is mainly for debugging purposes.

  • [locale='en'] String optional

    The locale in which to present the view, in ISO 639-1 form.

openRegistrationView

(
  • onSuccess
  • onError
  • [confirmedUserDataId=null]
  • [locale='en']
)

Presents the registration view in an iframe that covers the entirety of the current document.

Parameters:

  • onSuccess Function

    A callback that will be activated upon successful registration. This callback will be passed the user token received during the registration process.

  • onError Function

    A callback that will be activated if an error occurs during registration. This callback will be passed an error code related to the error. This code should not be presented to the user and is mainly for debugging purposes.

  • [confirmedUserDataId=null] String optional

    ID for pre-confirmed user data that allows the registration view to already know the user's identity without requesting a phone number.

  • [locale='en'] String optional

    The locale in which to present the view, in ISO 639-1 form.

setApiKey

(
  • apiKey
)

Sets the API key to use in following calls.

Parameters:

  • apiKey String

    Merchant’s public API key for this application.