Create transaction: stocks order

Create a transactionId for single stock or basket orders

Notes:

  1. This request to generate transactionId through Gateway API must be done from the backend platform (not client interface). This is to ensure that the apiSecret & secret are not exposed

  2. The orders are placed with NSE as the exchange. Hence the SECURITIES array in the orderConfig must contain NSE tickers for each stock

  3. Transaction type & quantity are optional fields at stock level. However, if specified, these must be specified for all stocks in the array


How to define SECURITIES array, examples below -

code snippets
{
    "intent": "TRANSACTION",
    "orderConfig": {
        "type": "SECURITIES",
        "securities": [
            {
                "ticker": "RELIANCE",
            },
            {
                "ticker": "TCS",
            }
        ]
    }
}
{
    "intent": "TRANSACTION",
    "orderConfig": {
        "type": "SECURITIES",
        "securities": [
            {
                "ticker": "RELIANCE",
                "quantity": 10,
            },
            {
                "ticker": "TCS",
                "quantity": 10,
            }
        ]
    }
}
{
    "intent": "TRANSACTION",
    "orderConfig": {
        "type": "SECURITIES",
        "securities": [
            {
                "ticker": "RELIANCE",
                "type": "BUY"
            },
            {
                "ticker": "TCS",
                "type": "SELL"
            }
        ]
    }
}
{
    "intent": "TRANSACTION",
    "orderConfig": {
        "type": "SECURITIES",
        "securities": [
            {
                "ticker": "RELIANCE",
                "quantity": 10,
                "type": "BUY"
            },
            {
                "ticker": "TCS",
                "quantity": 10,
                "type": "BUY"
            }
        ]
    }
}

How NOT to define SECURITIES array, examples below -

code snippets
{
    "intent": "TRANSACTION",
    "orderConfig": {
        "type": "SECURITIES",
        "securities": [
            {
                "ticker": "RELIANCE",
                "type": "BUY"
            },
            {
                "ticker": "TCS",
                "quantity": 10
            }
        ]
    }
}
{
    "intent": "TRANSACTION",
    "orderConfig": {
        "type": "SECURITIES",
        "securities": [
            {
                "ticker": "RELIANCE",
            },
            {
                "ticker": "TCS",
                "quantity": 10,
                "type": "BUY"
            }
        ]
    }
}
{
    "intent": "TRANSACTION",
    "orderConfig": {
        "type": "SECURITIES",
        "securities": [
            {
                "ticker": "RELIANCE",
                "quantity": 10,
            },
            {
                "ticker": "TCS",
            }
        ]
    }
}

Limit Orders

Now users can place limit order for supported brokers (5Paisa & Zerodha).

learn more

Users can either directly enter relevant limit order details in smallcase Gateway's order modal, or you can ask user to enter those details in your interface and smallcase Gateway will pre-fill the same in order modal.

Request structure still remains the same. There are some additional keys that needs to be sent in orderConfig.securities[] -

  1. orderType (string)
    Possible values are -
    • MARKET (default)
    • LIMIT
    • SL
    • SLM
  2. price (number)
  3. triggerPrice (number)

User will have an option to place limit order based on broker support. If not supported, the order will be considered as a market order.

orderTypepricetriggerPrice
MARKET--
LIMITrequired-
SLM-required
SLrequiredrequired

Example -

{
    "intent": "TRANSACTION",
    "orderConfig": {
        "type": "SECURITIES",
        "securities": [
            {
                "ticker": "RELIANCE",
                "type", "SELL",
              	"orderType": "LIMIT",
                "price": 2500
            },
            {
                "ticker": "INFY",
                "type": "BUY",
                "orderType": "SL",
                "price": 1700,
                "triggerPrice": 1710
            },
            {
                "ticker": "LICI",
                "type": "BUY",
                "orderType": "SLM",
                "triggerPrice": 3000
            },
            {
                "ticker": "ITC",
                "type", "BUY",
              	"orderType": "MARKET"
            }
        ]
    }
}

Custom basket image & name

In the login popup & order modal, integration partner's name & logo is displayed by default.

In case if you want to brand stock basket which user is investing in, same can be powered. Your stock basket's name & image will be displayed in relevant gateway screens.

learn more
{960}

The headers will have custom basket name & image

How to add this customisation?

Passing the basket name & image URL in the create transaction API is all that needs to be done. On triggering the transaction with basket meta, the same will be displayed to the user.

Sample request -

{
     "intent": "TRANSACTION",
     "orderConfig": {
          "type": "SECURITIES",
          "securities": [
               {
                    "ticker": "TCS"
               },
               {
                    "ticker": "INFY"
               }
          ],
          "meta": {
               "orderName": "Smart Basket",
               "orderLogo": "https://avatars.dicebear.com/api/bottts/smart+basket.png"
          }
     }
}

Request parameters

Path Params
string
required
Defaults to gatewaydemo
Body Params
string
required
Defaults to TRANSACTION

Required | Define the intent of transactionId. Value: "TRANSACTION"

orderConfig
object
required

Required | Transact on one or more stocks/ETF

string

Optional | upto 256 characters, returned in the transaction response

string
enum
Defaults to v1

Defines which SST order UI flow to be show v1 or v2

Allowed:
Headers
string
required
Defaults to gatewayDemo_secret

Required | apiSecret shared for authentication

string
required
Defaults to eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJndWVzdCI6dHJ1ZSwiaWF0IjoxNjU0MzIxMDAwfQ.qiZ_w1yFYXhkdLMlqI28XJOXitfZwr64e2oL-lMEHZU

Required | JWT signed with shared secret & payload of guest user or connected user

Response

Language
LoadingLoading…
Response
Click Try It! to start a request and see the response here! Or choose an example:
application/json