Buttons with customer specific data

rajeshbadiye
Hello,
Samples given for adding button uses hard coded values.

When customer wants to buy stock of XXX symbol, NNN qty from ZZZ exchange then do we need to build a screen for accepting relevant data required for triggering buy/sell order?
As given in API docs,
We need to add following snippet in our page

KiteConnect.ready(function() {
// Initialize a new Kite instance.
// You can initialize multiple instances if you need.
var kite = new KiteConnect("your_api_key");
....
....
}

Do we need to invoke kite.add() function from our page to add orders in basket and then use your button to submit order?

There is something not pretty clear on what needs to be done by vendor like to submit order as per our customer's requirement.

Please elaborate little bit more on this.

-Rajesh
  • vishnus
    Hi @rajeshbadiye ,

    1. Yes you need to have your own page if you need to accept the values from users. You can generate your own custom buttons based on user input. Or else you can always display buttons with hardcoded values like in the examples. User can edit these values from the order window.

    2. Yes. You should create an order object and using kite.add() you can add them to the basket. Once all orders are added you can render button. Then once user clicks on it, the basket will be auto generated based on the orders added to the kite object.

    Please refer to all the method and parameter descriptions in the documentation: https://kite.trade/docs/connect/v1/#generating-dynamic-buttons-with-javascript

    Also you can check the publisher demo page for live examples:
    https://kite.trade/publisher-demo

    Thanks
Sign In or Register to comment.