Skip to main content
This section describes the available session actions. With these actions, session variables can be written or a locked session can be unlocked again after a failed payment process, for example.

Actions overview

ActionDescription
SessionUpdateWrites a value to a session variable.
SessionUnlockUnlocks the session after a failed online payment process.

Actions

SessionUpdate

This action writes a value to a session variable. The variable is addressed via the parameter name session.(variableName), where variableName stands for the desired key within the session. Usage example
Useful for storing user-defined state information in the session during the user experience, e.g., a selected filter, progress in the checkout, or a temporary note that should be available across pages.
Parameters
NameDescription
session.(variableName)The key and value of the session variable to be set.
Related modules, variables & methods Example showing how a value is written to a session variable and then read out.
{{ var $myActionSessionUpdate = $wsActions.create("SessionUpdate") }}
<form method="post" action="{{= $wsViews.current.url() }}">
    <input type="hidden" name="wscsrf" value="{{= $myActionSessionUpdate.csrf }}">
    <input type="hidden" name="wsact" value="{{= $myActionSessionUpdate.id }}">
    <input type="hidden" name="session.lastViewedCategory" value="Running shoes">
    <button type="submit">Save.</button>
</form>

{{ if $wsSession.get("lastViewedCategory") }}
    Category: {{= $wsSession.get("lastViewedCategory") }}
{{ /if }}

SessionUnlock

This action unlocks a locked session. A session can enter a locked state after a failed online payment process to prevent unintended follow-up actions. SessionUnlock resets this lock state so the customer can restart or continue the process. This action expects no parameters and returns no error responses. Usage example
Can be used on an error or return page after a failed payment process to enable the customer to retry the payment or select another payment method.
Related modules, variables & methods Example showing how a customer with a locked session is given the option to unlock it via a button.
{{ if $wsSession.isLocked }}
    {{ var $myActionSessionUnlock = $wsActions.create("SessionUnlock") }}
    <form method="post" action="{{= $wsViews.current.url() }}">
        <input type="hidden" name="wscsrf" value="{{= $myActionSessionUnlock.csrf }}">
        <input type="hidden" name="wstarget" value="{{= $wsViews.current.url() }}">
        <input type="hidden" name="wsact" value="{{= $myActionSessionUnlock.id }}">
        <button type="submit">Unlock session.</button>
    </form>
{{ /if }}