Create a Widget session

The initialization of a widget session is similar to the way it is done for the Checkout. A session is first created on the backend channel, and a token is received that is used to render the widget throughout that user session.

/*
POST /widget HTTP/1.1
Host: checkout-api-uat.collector.se
Content-Type: application/json
Authorization: SharedKey bXlVc2VybmFtZTpmN2E1ODA4MGQzZTk0M2VmNWYyMTZlMDE...
*/
{
"storeId": 123
}

Request headers

HeaderRequiredExplanation
AuthorizationYesInstructions on how to generate the authorization header value can be found here.
Note that the authorization header is generated with the access credentials (usename and shared access key) received from Collector Merchant Services.

Request Body Properties

PropertyRequiredExplanation
storeIdYesReceived from Collector Merchant Services.

Response

PropertyExplanation
widgetTokenThe widgetToken is used to render the widget iframe.
expiresAtThe timestamp when this widget session expires.
Important

The widgetToken should be reused for all widgets until it expires. Failing to do so will put our system under an unnecessary performance load, and might lead to a temporary shutdown of the feature for you.