How to use trade button in Android application?

finaureus

I want to use Kite's Trade button in Android application for executing a basket of stocks.
We want to use Kite Connect API for that.

How can I achieve this?
  • sujith
    You will have to use Kite Publisher for that. You can know more here. You can take a look at the demo here.
    Basically, you need to open your webpage which will invoke the Kite Publisher with all the params.
  • finaureus
    Is there any way to use Trade button directly in native android application using kiteconnect.jar library?
  • finaureus
    I do render the trade button in .html file. When I am clicking on trade button I am facing below error

    Webpage not available
    https://kite.trade/connect/login?sess_id=Vk6Wr9.......
    could not be loaded because :
    net: ERR_BLOCKED_BY_RESPONSE

    I tried debugging this error by enabling WebView debug, then after inspecting I received below error

    Refused to frame 'https://kite.zerodha.com/' because an ancestor violates the following Content Security Policy directive: "frame-ancestors 'self' https://microapps.google.com/".

    Please help.
  • finaureus
    @sujith Please suggest.
  • sujith
    We have asked the concerned team to look into this.
  • sujith
    This should be fixed. You can try and let us know if you are still facing the issue.
  • finaureus
    finaureus edited December 2020
    Now the above issue is resolved and I am able to load login page of Zerodha in WebView.
    But after, entering PIN I am getting below two errors :

    Failed to load resource: the server responded with a status of 400 ()
    Blocked autofocusing on a form control in a cross-origin subframe. chunk-vendors.ea6114a1.js:35
  • sujith
    How is the user flow? You have a trade button on your website and the on click of it you open publisher?
  • sujith
    Can you make a video of user flow?
  • sujith
    We tried this URL on a sample webview and it seems fine.
  • finaureus
    finaureus edited December 2020
    I have trade button in .js file and I have loaded .js file in Android WebView. I will post video soon. On Website it is working fine. I am facing problem with webview only.
  • finaureus
    Please find the Login flow video attached with link : Login flow
  • finaureus
    I also tried by using URL. But facing same issue. It is redirected to Login page. And debugger shows error
    Failed to load resource: the server responded with a status of 400 ()
    Blocked autofocusing on a form control in a cross-origin subframe. chunk-vendors.ea6114a1.js:35
  • sujith
    The video is not clear. Can you private message with a proper video?
Sign In or Register to comment.