title: Razorpay payment gateway integration asp.net core
body: <p>I am beginner to integrate razorpay payment gateway on our angular and asp.net core website. Getting 500 error while posting the data to gateway url. Please check my code and pour your answers. Ia m searching it for nearly 2 days.</p>
  <pre><code> public async Task&lt;IActionResult&gt; CreateOrder([FromBody] TicketSales Sales)
          {
              System.Net.ServicePointManager.SecurityProtocol |= SecurityProtocolType.Tls11 | SecurityProtocolType.Tls12;
              string razorkey = &quot;key&quot;;
              string secret = &quot;secret&quot;;
              RazorpayClient client = new RazorpayClient(razorkey, secret);
              Dictionary&lt;string, object&gt; options = new Dictionary&lt;string, object&gt;();
              options.Add(&quot;amount&quot;, Sales.subTotal.Replace(&quot;.&quot;, &quot;&quot;)); // amount in the smallest currency unit
              options.Add(&quot;receipt&quot;, &quot;Receipt_567&quot;);
              options.Add(&quot;currency&quot;, &quot;INR&quot;);
              options.Add(&quot;payment_capture&quot;, &quot;0&quot;);
              Order order = client.Order.Create(options);
              using (var httpClient = new HttpClient())
              {
                  httpClient.BaseAddress = new Uri(&quot;https://api.razorpay.com/v1/checkout/embedded&quot;);
                  var content = new FormUrlEncodedContent(new[]
                  {
                  new KeyValuePair&lt;string, string&gt;(&quot;key&quot;,razorkey),
                  new KeyValuePair&lt;string, string&gt;(&quot;Amount&quot;, Sales.subTotal),
                  new KeyValuePair&lt;string, string&gt;(&quot;currency&quot;, &quot;INR&quot;),
                  new KeyValuePair&lt;string, string&gt;(&quot;name&quot;,Sales.bName),
                  new KeyValuePair&lt;string, string&gt;(&quot;description&quot;,&quot;Test Transaction&quot;),
                  new KeyValuePair&lt;string, string&gt;(&quot;imag&quot;, &quot;&quot;),
                  new KeyValuePair&lt;string, string&gt;(&quot;order_id&quot;,Convert.ToString(order[&quot;id&quot;])),
                  new KeyValuePair&lt;string, string&gt;(&quot;callback_url&quot;,&quot;localhost:4200//signin&quot;),
  
              });
                  var result = await httpClient.PostAsync(&quot;https://api.razorpay.com/v1/checkout/embedded&quot;, content);
                  if (result.IsSuccessStatusCode)
                  {
                              
                  }   
  
              }
              return Json(new { orderId = order[&quot;id&quot;].ToString(),result });
          }
  </code></pre>