Klarna Web SDK v2
    Preparing search index...

    Interface KlarnaConfig

    Config package. Runtime configuration for integration metadata and session.

    interface KlarnaConfig {
        IntegrationMetadata: IntegrationMetadata;
        setAcquiringConfig(acquiringConfig: AcquiringConfig): Promise<void>;
        setKlarnaNetworkSessionToken(
            klarnaNetworkSessionToken: string,
        ): Promise<void>;
        setPartnerAccountId(partnerAccountId: string): Promise<void>;
        setSdkToken(sdkToken: string): Promise<void>;
    }
    Index
    IntegrationMetadata: IntegrationMetadata

    Interface for managing integration metadata dynamically.

    • Parameters

      • acquiringConfig: AcquiringConfig

        The acquiring configuration for payment account.

      Returns Promise<void>

      "Enables integrators to dynamically specify the acquiring configuration at runtime."

      label="Example"

      await klarna.Config.setAcquiringConfig({
      paymentAcquiringAccountId: "acq-account-123",
      paymentAccountReference: "partner-ref-456",
      });

      Config

      Config.setAcquiringConfig

      Config

      general-availability

      Config.setAcquiringConfig

      true

      true

    • Parameters

      • klarnaNetworkSessionToken: string

        The token to resume the session.

      Returns Promise<void>

      "Sets a Klarna Network Session token to resume a previously established session. Use this when the customer navigates between pages (e.g. from cart to checkout) and you need to restore the SDK session without requiring the customer to re-authenticate. The token is typically obtained from your server after the initial payment flow or from the onComplete callback."

      label="Example"

      // Fetch the session token from your server
      const response = await fetch("/api/klarna/session-token");
      const { klarnaNetworkSessionToken } = await response.json();

      // Resume the Klarna session on the new page
      await klarna.Config.setKlarnaNetworkSessionToken(klarnaNetworkSessionToken);

      Config

      Config.setKlarnaNetworkSessionToken

      Config

      general-availability

      Config.setKlarnaNetworkSessionToken

      true

      true

    • Parameters

      • partnerAccountId: string

        The partner account ID to use for subsequent operations.

      Returns Promise<void>

      "Enables integrators to dynamically specify the Partner's account ID at runtime. This field is only used when the integrator is an Acquiring Partner or has a complex partner account setup. For direct integration or partner integration, this field can be omitted.

      Call this before initiating a payment when the partner account differs from the one used during SDK initialization."

      label="Example"

      // Switch to a specific partner account before creating a payment
      await klarna.Config.setPartnerAccountId("partner-account-456");

      Config

      Config.setPartnerAccountId

      Config

      general-availability

      Config.setPartnerAccountId

      true

      true

    • Parameters

      • sdkToken: string

        The SDK token to resume a session.

      Returns Promise<void>

      "Enables integrators to dynamically specify an SDK token that can resume a session.

      Migration: Replace calls to setSdkToken with {@docs-portal-link Config.setKlarnaNetworkSessionToken}. The token value is the same — only the method name has changed."

      label="Example"

      // Deprecated — migrate to setKlarnaNetworkSessionToken
      await klarna.Config.setSdkToken("eyJhbGciOi...");

      // New equivalent
      await klarna.Config.setKlarnaNetworkSessionToken("eyJhbGciOi...");

      use {@docs-portal-link Config.setKlarnaNetworkSessionToken} instead. This property will be removed in future versions.

      Config

      Config.setSdkToken

      Config

      deprecated

      Config.setSdkToken

      true

      true