checkout:start
On this page
checkout:start starts checkout from a cart, performing the same validation the cart Pay button uses. It can be configured on a POS action item or called from custom JavaScript via pos-sc-action.
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
cart_sc_id |
String | No | Salesforce ID of the cart to start checkout from. If omitted, the active cart is used. If provided and different from the active cart, that cart is resumed first. |
Behavior
- If
cart_sc_idrefers to a cart other than the active one, the action resumes that cart first (using the same linkage safety check ascart:resume). - The cart is validated using the same rules the Pay button uses. If any check fails, an alert modal explains the reason and the action stops.
- The checkout type is set to
POS_ORDER. - If the cart has a non-zero amount to pay (the common case), the user is taken to the checkout payment screen.
- If the cart total is zero (e.g. a fully-deposited cart or a pure refund), the order is created immediately and the user is navigated to the order record. For refund carts, the matching credit p[…]
If cart_sc_id refers to a cart that is already linked to an order, the existing “order connected” modal is shown instead of starting checkout — matching the behavior of cart:resume.
Validation rules
The action shows an alert and stops if any of the following conditions are detected:
| Reason | Alert message |
|---|---|
empty_cart |
Unable to start checkout with an empty cart |
syncing |
Cart is still syncing. Please wait and try again. |
pending_items |
Some items are still being added. Please wait and try again. |
expired_items |
A rental hold has expired. Review the cart before proceeding. |
fulfillment_needs_attention |
Delivery details have changed. Please confirm them before continuing. |
customer_required_subscription |
A customer is required to check out subscription items. |
customer_required_serial_item |
A customer is required to check out items with serial numbers. |
customer_required_delivery |
A customer is required to check out a delivery or non-takeaway fulfillment. |
customer_required_rental |
A customer is required to check out rental items. |
customer_required_voucher |
A customer is required for vouchers that auto-generate a code or PIN. |
customer_required |
A customer is required for this order. |
serial_numbers_missing |
Serial numbers are missing for one or more items. |
invalid_discount |
Cart discount exceeds the maximum allowed for the current items. |
Returned context
When checkout starts successfully, the action returns context available to the next action in a chain or to Liquid templates:
| Field | Type | When |
|---|---|---|
cart_sc_id |
String | Always (the active cart at completion) |
order_id |
String | Only when a zero-total order was created immediately |
Usage
Action item configuration
Set the Action field on a s_c__Pos_Action_Item__c record:
checkout:start
To target a specific cart:
checkout:start
with Params set to:
cart_sc_id=<Salesforce cart ID>
Liquid/HTML template
html
<button type="button" onclick="scAction('checkout:start')">Pay</button>
html
<button
type="button"
onclick="scAction('checkout:start', { cart_sc_id: '{{ cart.id }}' })"
>
Resume and pay
</button>
JavaScript
javascript
scAction('checkout:start')
scAction('checkout:start', { cart_sc_id: 'abc-123' })
With success/error handling:
javascript
scAction(
'checkout:start',
{},
{
onSuccess: () => console.log('Checkout started'),
onError: (error) => console.error('Could not start checkout:', error),
}
)