Skip to main content
The stock purchase view allows the user to confirm an amount to purchase for a given stock. This flow is particularily important given that a POST request must be made in order to create the purchase order request.

Accessing the stock purchase view

Pass 1 as the option key to the choice parameter.
  curl --request POST \
    --url https://api.staging.pipevest.com/v1/ussd/process
    ...
    --data 'sessionId=<session-id>'
    --data 'choice=1'
Example Response
{
    "message": "USSD request processed successfully",
    "data": {
        "sessionId": "ussd_5310deea137a9cd999b02ae68a7bbbec",
        "currentState": "BUY_STOCK",
        "menu": {
            "state": "BUY_STOCK",
            "text": "Buy Apple Inc. (AAPL)\n\nSelect amount to invest:",
            "options": [
                {
                    "key": "1",
                    "label": "ZK22.00",
                    "nextState": "PURCHASE_CONFIRMATION",
                    "data": {
                        "amount": 22
                    }
                },
                {
                    "key": "2",
                    "label": "ZK112.00",
                    "nextState": "PURCHASE_CONFIRMATION",
                    "data": {
                        "amount": 112
                    }
                },
                {
                    "key": "3",
                    "label": "ZK562.00",
                    "nextState": "PURCHASE_CONFIRMATION",
                    "data": {
                        "amount": 562
                    }
                },
                {
                    "key": "4",
                    "label": "Enter custom amount",
                    "nextState": "ENTER_CUSTOM_PURCHASE_AMOUNT"
                },
                {
                    "key": "0",
                    "label": "Back",
                    "nextState": "SELECT_STOCK"
                }
            ],
            "isEndState": false
        },
        "ussdText": "Buy Apple Inc. (AAPL)\n\nSelect amount to invest:\n\n1. ZK22.00\n2. ZK112.00\n3. ZK562.00\n4. Enter custom amount\n0. Back",
        "expiresAt": "2025-11-06T14:58:33.942Z"
    }
}

Confirming order purchase request

This is the menu that is displayed once the customer has chosen to purchase a stock. From here the customer can choose to confirm the purchase or go back to the individual stock menu.
  curl --request POST \
    --url https://api.staging.pipevest.com/v1/ussd/process
    ...
    --data 'sessionId=<session-id>'
    --data 'choice=1'
{
    "message": "USSD request processed successfully",
    "data": {
        "sessionId": "ussd_5310deea137a9cd999b02ae68a7bbbec",
        "currentState": "PURCHASE_CONFIRMATION",
        "menu": {
            "state": "PURCHASE_CONFIRMATION",
            "text": "Confirm stock purchase:\n\nStock: Apple Inc. (AAPL)\nAmount: ZK22.00\n\nPress \"1\" to confirm purchase and agree to terms and conditions (pipevest.com/terms).",
            "options": [
                {
                    "key": "1",
                    "label": "Confirm",
                    "nextState": "PURCHASE_SUCCESS"
                },
                {
                    "key": "0",
                    "label": "Back",
                    "nextState": "BUY_STOCK"
                }
            ],
            "isEndState": false
        },
        "ussdText": "Confirm stock purchase:\n\nStock: Apple Inc. (AAPL)\nAmount: ZK22.00\n\nPress \"1\" to confirm purchase and agree to terms and conditions (pipevest.com/terms).\n\n1. Confirm\n0. Back",
        "expiresAt": "2025-11-06T14:58:33.942Z"
    }
}

Stock Purchase Example

USSD Stock Purchase View

Check out an example of the ussd stock purchase view