title: How to get created orderID in RazorPay?
body: <p>As mentioned in <a href="https://docs.razorpay.com/docs/orders" rel="nofollow noreferrer">https://docs.razorpay.com/docs/orders</a>, the <code>API</code> is given to create a new order in razor(I need it for auto capturing as mentioned in <a href="https://docs.razorpay.com/page/orders" rel="nofollow noreferrer">https://docs.razorpay.com/page/orders</a>). On the right side of the page the code is also given (JAVA), to create a new order, but when I run the code, I got the <code>networkmainthread</code> exception, so I ran the code using <code>asynctask</code>. But now the problem is how do I check the response of the code, and will I get the order id. This part is not mentioned in the documentation.</p>
  <pre><code>import com.razorpay.Order;
  import org.json.JSONObject;
  import com.razorpay.RazorpayClient;
  import com.razorpay.RazorpayException;
  
  RazorpayClient razorpay = new RazorpayClient(&quot;&lt;api_key&gt;&quot;, &quot;&lt;api_secret&gt;&quot;);
  try {
    JSONObject orderRequest = new JSONObject();
    orderRequest.put(&quot;amount&quot;, amount); // amount in paise
    orderRequest.put(&quot;currency&quot;, &quot;INR&quot;);
    orderRequest.put(&quot;receipt&quot;, &quot;test_1&quot;);
    orderRequest.put(&quot;payment_capture&quot;, false);
  
    Order order = razorpay.Orders.create(orderRequest);
  } catch (RazorpayException e) {
    // Handle Exception
    System.out.println(e.getMessage());
  }
  </code></pre>