Callback/Postback not working

The API Postback when oder changes is not working.
I have registered a Postback URL with a LetsEncrypt trusted SSL certificate.
My server receive a HEAD request to the callback url when saving the KITE Connect App settings. But I never receive a callback when an order changes with the associated account.

Why not?
  • Prutheus
    Should I respond with something to the HEAD request, e.g. Status 200 or so?
  • sujith
    It is difficult to say what would have gone wrong.
    You can refer to this example.
  • Prutheus
    I have exactly the same code, but my Nginx tells me that I never get a post request to my url.
  • Prutheus
    I now did the same like in example, and also in then grok inspect console, like someone commented at the example, I only get the HEAD request but no POST request so no callback is issued. Is a callback issued when I create an AMO order or should there no callback been issued?
  • Prutheus
    @sujith what should I do now? can you check the logs of kite connect of my app? please help me.
  • rakeshr
    Did AMO order failed with any_error msg while placing?
    You can verify the same once from Kite web order book.
  • Prutheus
    Prutheus edited November 2019
    @rakeshr @sujith

    no it didn't. can you check if I need to have a special response to the initial HEAD request to the callback url? and is my ssl certificate wrong? I have some from lets encrypt.
  • Prutheus
    Prutheus edited November 2019
    @rakeshr @sujith what must be the correct response to the HEAD request?
  • krishmetra
    I have this simple PHP code for the postback page. Try this and see if it works for you.

    // Checksum verification to be added here.
    $t1 = time();
    $t2 = rand(1,100000);
    $file = $t1."_".$t2.".txt";
    $data = file_get_contents('php://input');

  • Prutheus
    @krishmetra no it does not work, my server (nginx) eben do not receive a Post request. Just the HEAD request when setting the url in the kite console. Do I need a special response to the HEAD so it will work?
  • krishmetra
    You don't need to send any response to the HEAD.
    I think it is your server or url issue. Just try to send some dummy post requests and see how your server / url works.
  • Prutheus
    Prutheus edited November 2019

    it works. my server does not get the POST request. not my server application like in python or php, the real server, where an Nginx is listening. then, I tried local with ngrok, and also grok does not receive the POST request, just HEAD requests when setting the url in the console.
  • Prutheus
    @krishmetra can you create a url for me on your server so we can test if the problem is based on my server that it is not receiving the request? I register your url at my kite console and we test then?
  • cephalik
    cephalik edited January 2020
    I'm assuming you're using Postman to check the POST response to the callback URL?
    Make sure that you are using https://{postback_url} and not http://{postback-url}

    If you're using Postman, most likely you're sending the POST request to http://{postback-url}. In this case, NGINX will create a 301 redirect to the HTTPS postback url and since 301 redirects are always GET you won't register the callback.

    Hope this solves the problem.
Sign In or Register to comment.