Square Payment Processing Error: HTTP Response Not OK | Using Connect .net API
Square Payment Processing Error: HTTP Response Not OK | Using Connect .net API
我正在使用 Connect Square 的 asp.net API 来生成随机数并创建付款。我的付款表格正在正确加载生成随机数但未创建付款请求。这是错误响应
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
这是第 60 行的代码.. 付款创建
public void OnPost()
{
string nonce = Request.Form["nonce"];
// IPaymentsApi paymentsApi = new PaymentsApi(this.BasePath);
// paymentsApi.Configuration.AccessToken = this.AccessToken;
IPaymentsApi PaymentsApi = client.PaymentsApi;
string uuid = NewIdempotencyKey(); //NewIdempotencyKey();
Money amount = new Money(100, "USD");
CreatePaymentRequest createPaymentRequest = new CreatePaymentRequest(amountMoney: amount, idempotencyKey: uuid, sourceId: nonce);
try
{
var response = PaymentsApi.CreatePayment(createPaymentRequest); \This is giving error
this.ResultMessage = "Payment complete! " + response;
}
catch (ApiException e)
{
this.ResultMessage = e.Message + e;
}
}
在沙盒环境和本地主机上工作。任何帮助将不胜感激
我的账户是 GPB,这里设置的货币是美元。异常是不打印错误详细信息。所以我们必须把它打印在一个对象中
我正在使用 Connect Square 的 asp.net API 来生成随机数并创建付款。我的付款表格正在正确加载生成随机数但未创建付款请求。这是错误响应
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
这是第 60 行的代码.. 付款创建
public void OnPost()
{
string nonce = Request.Form["nonce"];
// IPaymentsApi paymentsApi = new PaymentsApi(this.BasePath);
// paymentsApi.Configuration.AccessToken = this.AccessToken;
IPaymentsApi PaymentsApi = client.PaymentsApi;
string uuid = NewIdempotencyKey(); //NewIdempotencyKey();
Money amount = new Money(100, "USD");
CreatePaymentRequest createPaymentRequest = new CreatePaymentRequest(amountMoney: amount, idempotencyKey: uuid, sourceId: nonce);
try
{
var response = PaymentsApi.CreatePayment(createPaymentRequest); \This is giving error
this.ResultMessage = "Payment complete! " + response;
}
catch (ApiException e)
{
this.ResultMessage = e.Message + e;
}
}
在沙盒环境和本地主机上工作。任何帮助将不胜感激
我的账户是 GPB,这里设置的货币是美元。异常是不打印错误详细信息。所以我们必须把它打印在一个对象中