Klarna Web SDK v2/r8
    Preparing search index...

    Interface Transaction

    interface Transaction {
        widget: (widgetToken: string) => void;
        on(event: "widgeterror", callback: OnWidgetErrorCallback): void;
        on(event: "widgetcomplete", callback: OnWidgetCallback): void;
        on(event: "widgetcancel", callback: OnWidgetCallback): void;
    }
    Index

    Properties

    Methods

    Properties

    widget: (widgetToken: string) => void

    Type Declaration

      • (widgetToken: string): void
      • Parameters

        • widgetToken: string

          A token received from Klarna API that authenticates the widget.

          Example:

          Klarna.Customer.Transaction.widget("ey...")
          

        Returns void

    Customer

    Customer.Transaction.widget

    general-availability

    true

    true

    acquiring_partner Load the Klarna widget for the operation.

    The z-index of elements in application page calling widget() should not exceed 10000

    Methods

    • Parameters

      Returns void

      Customer

      Customer.Transaction.onWidgetError

      general-availability

      true

      true

      acquiring_partner Register an event handler for the widgeterror event. Anytime an error occurs during the widget flow, the error event is triggered. If the error event handler is defined, all errors will be emitted to it instead of thrown upwards in the widget method.

      Example

      klarna.Customer.Transaction.on("widgeterror", (error, widgetData) => {
      // Handle the error
      // widgetData contains the status of the widget
      // error contains the error details
      });
    • Parameters

      • event: "widgetcomplete"

        The event name.

      • callback: OnWidgetCallback

        Event callback handler.

      Returns void

      Customer

      Customer.Transaction.onWidgetComplete

      general-availability

      true

      true

      acquiring_partner Called when the widget is closed and there is a state change for the order.

    • Parameters

      • event: "widgetcancel"

        The event name.

      • callback: OnWidgetCallback

        Event callback handler.

      Returns void

      Customer

      Customer.Transaction.onWidgetCancel

      general-availability

      true

      true

      acquiring_partner Called when widget is closed and there is no state change for the order.