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

Properties

Methods

Properties

widget: (widgetToken: string) => void

Load the Klarna widget for the operation.

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

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

Methods

  • 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

    Returns void

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

    Parameters

    • event: "widgetcomplete"

      The event name.

    • callback: OnWidgetCallback

      Event callback handler.

    Returns void

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

    Parameters

    • event: "widgetcancel"

      The event name.

    • callback: OnWidgetCallback

      Event callback handler.

    Returns void