You are here:
Update Checkout Session Action
In a B2B Commerce Checkout flow, the Update Checkout Session action updates the checkout session state if the current state matches the expected state. This action provides consistency during checkout handling and guarantees that if two browsers attempt to update the state, one succeeds and the other fails validation.
Required Editions
| Available in: Lightning Experience |
| View supported editions. |
In Flow Builder, add an Action element to your flow. Select the B2B
Commerce category, and search for Update Checkout Session
Action. To access this action from the API, use the name updateCheckoutSessionAction.
Set Input Values
Use values from earlier in the flow to set the inputs.
| Input Parameter | Description |
|---|---|
| checkoutSessionId | The ID of the checkout session. |
| nextState | The state the session moves to after it completes the tasks included in the current state. This input is an Apex-defined variable of enum |
| expCurrentState | The current state of the session. This input is an Apex-defined variable of enum
|
Store Output Values
| Output Parameter | Description |
|---|---|
| requestId | The ID of the request that processes and then either creates or returns the Checkout Session. |
Error Conditions
| Error Condition | Description |
|---|---|
| Expected Validation Error | The current state of the checkout session, identified by HTTP Status Code: 4XX |
| Invalid Checkout Session ID | Invalid input for the Checkout Session ID. Error Code: UNKNOWN_EXCEPTION HTTP Status Code: 403 |
| Invalid Session or Inadequate User Access | Either the session doesn’t exist or the user doesn’t have the required permissions. Error Code: INSUFFICIENT_ACCESS_OR_READONLY HTTP Status Code: 400 |
| User Can’t Invoke Action | The caller doesn’t have the appropriate permissions to call the action, including the MAD or B2B Commerce Integrator user perms. Error Code: BAD_REQUEST HTTP Status Code: 400 |
| Account Associated With Cart Is Invalid or Inaccessible | The effective account associated with the cart isn’t a valid account. Error Code: INSUFFICIENT_ACCESS_OR_READONLY HTTP Status Code: 400 |
| User Isn’t a Member of the Store | The buyer user isn’t a member of the store. Error Code: INSUFFICIENT_ACCESS_OR_READONLY HTTP Status Code: 400 |
Usage
To use the B2B Commerce Update Checkout Session Action, these requirements apply.
- The user has the appropriate permissions to invoke the action.
- The effective account is valid.
- The buyer account is a member of the store.
- The cart status isn’t set to
ClosedorProcessing. - The CartcheckoutSession.IsProcessing field is
false.

