> ## Documentation Index
> Fetch the complete documentation index at: https://docs.pipevest.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Stocks Menu View

The stocks menu view contains the available stocks that can be purchased.

<Frame>
  <img className="block dark:hidden" src="https://mintcdn.com/pipevest/l6kPGYU9W55pgekc/images/ussd-stocks.png?fit=max&auto=format&n=l6kPGYU9W55pgekc&q=85&s=60142e046beea03bf997b8c5647c4029" width="3790" height="1632" data-path="images/ussd-stocks.png" />

  <img className="hidden dark:block" src="https://mintcdn.com/pipevest/l6kPGYU9W55pgekc/images/ussd-stocks-dark.png?fit=max&auto=format&n=l6kPGYU9W55pgekc&q=85&s=8f90a549b6f59f1de3c6e014e0918bec" width="3790" height="1632" data-path="images/ussd-stocks-dark.png" />
</Frame>

### Accessing the stocks view

<Tip>
  This is the menu that is displayed once the customer has chosen to view stocks.
  From here the customer can choose to view an individual stock or search for a stock.
</Tip>

**Example Response**

```json theme={null}
{
    "message": "USSD request processed successfully",
    "data": {
        "sessionId": "ussd_5310deea137a9cd999b02ae68a7bbbec",
        "currentState": "STOCKS",
        "menu": {
            "state": "STOCKS",
            "text": "Select Stock:",
            "options": [
                {
                    "key": "1",
                    "label": "AAPL",
                    "nextState": "SELECT_STOCK",
                    "data": {
                        "stockId": "cmhkp4jkw0005zxfok9m0kiwg",
                        "symbol": "AAPL",
                        "name": "Apple Inc."
                    }
                },
                ...
                {
                    "key": "7",
                    "label": "Next Page"
                },
                {
                    "key": "8",
                    "label": "Search Stock",
                    "nextState": "SEARCH_STOCK"
                },
                {
                    "key": "0",
                    "label": "Back to Home",
                    "nextState": "HOME"
                }
            ],
            "isEndState": false
        },
        "ussdText": "Select Stock:\n\n1. AAPL\n2. AMZN\n3. GOOGL\n4. JPM\n5. META\n7. Next Page\n8. Search Stock\n0. Back to Home",
        "expiresAt": "2025-11-06T14:58:33.942Z"
    }
}
```

#### Viewing individual stock

<Note>
  See the guide on [viewing an individual stock](/guides/ussd/individual-stock)
</Note>

#### Paging stocks view

```bash theme={null}
  curl --request POST \
    --url https://api.staging.pipevest.com/v1/ussd/process
    ...
    --data 'sessionId=<session-id>'
    --data 'choice=7'
```

<Note>
  The response will be similar to the initial request to [view the stock
  menu](#accessing-the-stocks-view)
</Note>

#### Searching for a stock

Returns a view that allows users to input a stock symbol.

```bash theme={null}
  curl --request POST \
    --url https://api.staging.pipevest.com/v1/ussd/process
    ...
    --data 'sessionId=<session-id>'
    --data 'choice=8'
```

**Example Response**

```json theme={null}
{
    "message": "USSD request processed successfully",
    "data": {
        "sessionId": "ussd_5310deea137a9cd999b02ae68a7bbbec",
        "currentState": "SEARCH_STOCK",
        "menu": {
            "state": "SEARCH_STOCK",
            "text": "Enter stock symbol or name:\n(e.g., AAPL or Apple)",
            "options": [
                {
                    "key": "0",
                    "label": "Cancel",
                    "nextState": "STOCKS"
                }
            ],
            "isEndState": false
        },
        "ussdText": "Enter stock symbol or name:\n(e.g., AAPL or Apple)\n\n0. Cancel",
        "expiresAt": "2025-11-06T14:58:33.942Z"
    }
}
```

#### Processing stock search

Pass the stock symbol or name to the `choice` parameter.

```bash theme={null}
  curl --request POST \
    --url https://api.staging.pipevest.com/v1/ussd/process
    ...
    --data 'sessionId=<session-id>'
    --data 'choice=Tesla'
```

**Example Response**

```json theme={null}
{
    "message": "USSD request processed successfully",
    "data": {
        "sessionId": "ussd_5310deea137a9cd999b02ae68a7bbbec",
        "currentState": "STOCKS",
        "menu": {
            "state": "STOCKS",
            "text": "Select Stock:",
            "options": [
                {
                    "key": "1",
                    "label": "TSLA",
                    "nextState": "SELECT_STOCK",
                    "data": {
                        "stockId": "cmhkp4km20009zxfoyv85kkij",
                        "symbol": "TSLA",
                        "name": "Tesla Inc."
                    }
                },
                {
                    "key": "8",
                    "label": "Search Stock",
                    "nextState": "SEARCH_STOCK"
                },
                {
                    "key": "0",
                    "label": "Back to Home",
                    "nextState": "HOME"
                }
            ],
            "isEndState": false
        },
        "ussdText": "Select Stock:\n\n1. TSLA\n8. Search Stock\n0. Back to Home",
        "expiresAt": "2025-11-06T14:58:33.942Z"
    }
}
```

### Stocks View Example

<Card title="USSD Stocks View" icon="boxes-stacked" href="https://www.figma.com/proto/xkSZwzsNTpYDNQiG0QGRlu/Zamtel-USSD-Flow?node-id=108-322&t=7ty9x1l3kywQhWlB-0&scaling=min-zoom&content-scaling=fixed&page-id=72%3A258&starting-point-node-id=108%3A69&show-proto-sidebar=1" horizontal>
  Check out an example of the ussd stock view
</Card>
