Skip to main content
The stocks menu view contains the available stocks that can be purchased.

Accessing the stocks view

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.
Example Response
{
    "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

Paging stocks view

  curl --request POST \
    --url https://api.staging.pipevest.com/v1/ussd/process
    ...
    --data 'sessionId=<session-id>'
    --data 'choice=7'
The response will be similar to the initial request to view the stock menu

Searching for a stock

Returns a view that allows users to input a stock symbol.
  curl --request POST \
    --url https://api.staging.pipevest.com/v1/ussd/process
    ...
    --data 'sessionId=<session-id>'
    --data 'choice=8'
Example Response
{
    "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"
    }
}
Pass the stock symbol or name to the choice parameter.
  curl --request POST \
    --url https://api.staging.pipevest.com/v1/ussd/process
    ...
    --data 'sessionId=<session-id>'
    --data 'choice=Tesla'
Example Response
{
    "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

USSD Stocks View

Check out an example of the ussd stock view