Welect Gmbh

Link

The Welect link is already completely configured and is ready to be used. The link starts and contains the whole Welect process. It can be used in an <a> Tag or called via JavaScript.

Example:

https://www.welect.de/passage/for_product/<our-id>/pre_offer

Exit

The exit mechanism can be configured in different ways.

When redirect is enabled

The predefined query parameter must be appended with the target url. The name can be individually defined by the Welect team. In this example the name of the query parameter is origin but it could also have a different name if required.

Example:

https://www.welect.de/passage/for_product/<our-id>/pre_offer?origin=https://www.welect.de

When per token message is enabled

This method is only useful if you are opening the link in an iframe.

Another exit mechanism is to send a message as an event. Any potential receiver of this message must be registered as an event listener.

Example:

const potentialReceiver = ({data}) => console.log(data);

window.addEventListener('message', potentialReceiver);

And this is what the receiver would get

interface TokenMessage {
    payload: string;
    payloadClass: string;
    type: string;
}

Example:

{ payload: "ADbhU5hveNhQjIivQkl_-IeYJAtiySsRoA==", payloadClass: "leaseToken", type: "welect:payload" }

Getting Token

In case of the exit method token message it is represented by the payload property of the data. Another way would be to add it as a query parameter with a predefined name. The name can be set by the Welect team.

In the example below the predefined name is wlct-token.

https://www.welect.de/?wlct-token=809982dd-f04b-445a-80c0-18ecb4eb6e8a