title: Square Payment Processing Error: HTTP Response Not OK | Using Connect .net API
body: <p>Im using asp.net API from Connect Square to generate nonce and create a payment. My payment form is loading correctly generating a nonce but not creating paymentrequest. Here is the error response</p>
  <pre><code>HTTP Response Not OKSquare.Exceptions.ApiException: HTTP Response Not OK at
   Square.Utilities.ApiHelper.RunTaskSynchronously(Task t) at
   Square.Apis.PaymentsApi.CreatePayment(CreatePaymentRequest body) at
   sqRazorSample.Pages.ProcessPaymentModel.OnPost() in 
  C:\Users\User\Desktop\csharp_payment\Pages\ProcessPayment.cshtml.cs:line 60
  </code></pre>
  <p>Here is the code at line 60.. payment Creation</p>
  <pre><code> public void OnPost()
      {
          string nonce = Request.Form[&quot;nonce&quot;];
          // IPaymentsApi paymentsApi = new PaymentsApi(this.BasePath);
          // paymentsApi.Configuration.AccessToken = this.AccessToken;
          IPaymentsApi PaymentsApi = client.PaymentsApi;
  
          string uuid = NewIdempotencyKey(); //NewIdempotencyKey();
          Money amount = new Money(100, &quot;USD&quot;);
  
          CreatePaymentRequest createPaymentRequest = new CreatePaymentRequest(amountMoney: amount, idempotencyKey: uuid, sourceId: nonce);
          try
          {
              var response = PaymentsApi.CreatePayment(createPaymentRequest); \\This is giving error
              this.ResultMessage = &quot;Payment complete! &quot; + response;
          }
          catch (ApiException e)
          {
              this.ResultMessage = e.Message + e;
          }
      }
  </code></pre>
  <p>Working in Sandbox environment and localhost. Anyhelp would be appreciated</p>