Not receiving Postback when an order is updated.

ZG1370
Hi,
I went through the postback API in which it is mentioned whenever any order is either cancelled or completed,
A registered postback will be called. I am getting HEAD request with the registered url not the POST request.
Can you help me into this asap?

Thanks
Rajesh Sharma.
Tagged:
  • sujith
    Hi Rajesh Sharma,
    The JSON payload is posted as a raw HTTP POST body.
    You will have to read the raw body and then decode it.
    The checksum is SHA-256 hash of order_id + timestamp + api_secret

    You can check out example here.
  • ZG1370
    ZG1370 edited November 2017
    Hi Sujith,

    For example, if i register postback call as "https://example.com/api/v2/postback". According to previous example logs should be available at "https://example.com/api/v2/postback/". But i am not able to see the logs. So from where i can see the logs for the day?

    Thanks.
  • sujith
    Are you sure you are reading body after you get request?
  • ZG1370
    I am getting only HEAD request. So can you elaborate how postback works? Means Why i am getting only HEAD request not POST?
  • tonystark
    Hi @ZG1370,

    Can you give us more details like how you set up your postback URL? Which language are you using? How you identified the request as HEAD?
  • ZG1370
    ZG1370 edited November 2017
    Hi ajinasokan,

    This is my implemented java code.
    {code}
    @PostMapping("/api/v2/aggregators/postbackorders")
    public ResponseEntity<?> getOrderStatusFromZerodha(@RequestBody ZerodhaOrderPostbackResponse response) {
    }

    Here is response that i am expecting JSON payload:
    public class ZerodhaOrderPostbackResponse {
    @JsonProperty("order_id")
    private String orderId;
    @JsonProperty("exchange_order_id")
    private String exchangeOrderId;
    @JsonProperty("placed_by")
    private String placedBy;
    @JsonProperty("status")
    private String status;
    @JsonProperty("status_message")
    private String statusMessage;
    @JsonProperty("tradingsymbol")
    private String tradingsymbol;
    @JsonProperty("exchange")
    private String exchange;
    @JsonProperty("order_type")
    private String orderType;
    @JsonProperty("transaction_type")
    private String transactionType;
    @JsonProperty("validity")
    private String validity;
    @JsonProperty("product")
    private String product;
    @JsonProperty("average_price")
    private Double averagePrice;
    @JsonProperty("price")
    private Double price;
    @JsonProperty("quantity")
    private Integer quantity;
    @JsonProperty("filled_quantity")
    private Integer filledQuantity;
    @JsonProperty("unfilled_quantity")
    private Integer unfilledQuantity;
    @JsonProperty("trigger_price")
    private Double triggerPrice;
    @JsonProperty("user_id")
    private String userId;
    @JsonProperty("order_timestamp")
    private String orderTimestamp;
    @JsonProperty("exchange_timestamp")
    private String exchangeTimestamp;
    @JsonProperty("checksum")
    private String checksum;
    }

  • tonystark
    Hi @ZG1370,

    This code looks fine. How you came to a conclusion that you are getting a HEAD request?
  • ZG1370
    ZG1370 edited November 2017

    Hi ajinasokan,

    I did check in apache tomcat. The same service was hit with a head request.
Sign In or Register to comment.