I am not getting order ID

anukum
Dear forum members,

i am able to place a order from my php application but i am not getting the order ID. the code i am using is pasted below. I request you to please help me with the below code. thank you.

$order_id = $kite->placeOrder("amo", [
"tradingsymbol" => 'SBIN20DECFUT',
"exchange" => "NFO",
"quantity" =>3000,
"transaction_type" =>'BUY',
"order_type" => "LIMIT",
"price" => '270',
"product" => 'NRML'
])["order_id"];

echo "Order id is ".$order_id;

Tagged:
  • rakeshr
    $order_id;
    $order_id is an object here(placeOrder return), you need to get order_id field from this. $order_id->order_id. If you want to print order id, it should be echo "Order id is ".$order_id->order_id;
  • anukum
    @rakeshr sir thanks for reply.

    But I am getting 500 http error. I am using the below code.


    $order_id = $kite->placeOrder("amo", [
    "tradingsymbol" => 'SBIN20DECFUT',
    "exchange" => "NFO",
    "quantity" =>3000,
    "transaction_type" =>'BUY',
    "order_type" => "LIMIT",
    "price" => '270',
    "product" => 'NRML'
    ])["order_id"];

    echo "Order id is ".$order_id->order_id;
  • rakeshr
    "price" => '270',
    The price value should be float instead of a string. You can check the PHP param data type detail here.
Sign In or Register to comment.