# RetailConnect Standard API

***

## 1. Import the API Module

Place the RetailConnect API module in:

```
ReplicatedStorage/RetailConnectAPI
```

Then require it in your SCO script:

```
local RetailConnect = require(game.ReplicatedStorage.RetailConnectAPI)
```

## 2. Send Events to RetailConnect

Use the `Send()` function to broadcast lane events.

#### Example: Approval Needed

```
RetailConnect:Send({
    System = "MySCO",
    Lane = 3,
    Status = "ApprovalNeeded",
    LockedBy = "EmployeeName"
})
```

#### Example: Assistance Required

```
RetailConnect:Send({
    System = "MySCO",
    Lane = 5,
    Status = "AssistanceRequired"
})
```

#### Example: Lane Closed

```
RetailConnect:Send({
    System = "MySCO",
    Lane = 2,
    Status = "LaneClosed"
})
```

#### Example: Lane Reopened

```
RetailConnect:Send({
    System = "MySCO",
    Lane = 2,
    Status = "LaneOpened"
})
```

## 3. Supported Status Types

| Status               | Description                      |
| -------------------- | -------------------------------- |
| `ApprovalNeeded`     | Customer scanned restricted item |
| `AssistanceRequired` | SCO needs staff help             |
| `LaneClosed`         | Lane has been closed             |
| `LaneOpened`         | Lane has been reopened           |
| *(Custom)*           | Any custom status you want       |

Custom statuses will still be displayed in VoCoVo.

## 4. What Happens Internally

When you call:

```
RetailConnect:Send({...})
```

RetailConnect will:

1. Send the event to the RetailConnectEvent RemoteEvent
2. The VoCoVo UI receives it
3. The message is formatted
4. The message appears in the VoCoVo headset chat
5. A notification sound plays (if enabled)

You don’t need to modify the VoCoVo UI — it already supports the API.

## 5. Example: Full Integration Snippet

Here’s a minimal SCO script using the API:

```
local RetailConnect = require(game.ReplicatedStorage.RetailConnectAPI)

local function onRestrictedItem(lane)
    RetailConnect:Send({
        System = "MySCO",
        Lane = lane,
        Status = "ApprovalNeeded"
    })
end

local function onHelpRequested(lane)
    RetailConnect:Send({
        System = "MySCO",
        Lane = lane,
        Status = "AssistanceRequired"
    })
end

local function onLaneClosed(lane)
    RetailConnect:Send({
        System = "MySCO",
        Lane = lane,
        Status = "LaneClosed"
    })
end
```

## That’s it!

Your SCO system is now fully integrated with RetailConnect.

#### No need to modify the VoCoVo UI

#### No need to modify the server handler

#### Works alongside DRS, JSM, PixelPay, and all existing integrations

#### Supports custom SCO systems

```
local VoCoVoEvent = game.ReplicatedStorage:FindFirstChild("VoCoVoMessage")
if not VoCoVoEvent then
VoCoVoEvent = Instance.new("RemoteEvent")
VoCoVoEvent.Name = "VoCoVoMessage"
VoCoVoEvent.Parent = game.ReplicatedStorage
end
local RetailConnectEvent = game.ReplicatedStorage:WaitForChild("RetailConnectEvent")
RetailConnectEvent.OnClientEvent:Connect(function(data)
-- data.System
-- data.Lane
-- data.Status
-- data.LockedBy
if not data or not data.Status or not data.Lane then
    return
end

local systemName = data.System or "Unknown System"
local lane = data.Lane
local status = data.Status
local lockedBy = data.LockedBy

local message = ""

if status == "ApprovalNeeded" then
    if lockedBy then
        message = string.format("%s: Lane %d requires approval (locked by %s)", systemName, lane, lockedBy)
    else
        message = string.format("%s: Lane %d requires approval", systemName, lane)
    end

elseif status == "AssistanceRequired" then
    if lockedBy then
        message = string.format("%s: Lane %d requires assistance (locked by %s)", systemName, lane, lockedBy)
    else
        message = string.format("%s: Lane %d requires assistance", systemName, lane)
    end

elseif status == "LaneClosed" then
    message = string.format("%s: Lane %d has been closed", systemName, lane)

elseif status == "LaneOpened" then
    message = string.format("%s: Lane %d has been reopened", systemName, lane)

else
    -- fallback for custom statuses
    message = string.format("%s: Lane %d status: %s", systemName, lane, status)
end

sendSystemMessage(message)
end)
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://document.retailpro.space/retailconnect-standard-api.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
