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.
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?
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.
@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?
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.
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.
@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?
@Prutheus 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.
You can refer to this example.
Did AMO order failed with any_error msg while placing?
You can verify the same once from Kite web order book.
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.
I have this simple PHP code for the postback page. Try this and see if it works for you.
<?php
// Checksum verification to be added here.
$t1 = time();
$t2 = rand(1,100000);
$file = $t1."_".$t2.".txt";
$data = file_get_contents('php://input');
file_put_contents($file,$data);
?>
I think it is your server or url issue. Just try to send some dummy post requests and see how your server / url works.
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.
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 nothttp://{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.