Payment API C# client.PaymentsApi.CreatePaymentAsync();

I am attempting to utilize the api example for creating payments in c# but can’t get Client to resolve and do not see where it is implemented in the example code.

try
{
  var result = await client.PaymentsApi.CreatePaymentAsync(body: body);
}
catch (ApiException e)
{
  Console.WriteLine("Failed to make the request");
  Console.WriteLine($"Response Code: {e.ResponseCode}");
  Console.WriteLine($"Exception: {e.Message}");
}

private SquareClient client;
private Square.Environment sqEnv; //sandbox or production
private string clientAccessToken; //your merchant account’s access token, or your customer’s (merchant) account’s access token if you are building for others.

client = new SquareClient.Builder()
.Environment(sqEnv)
.AccessToken(clientAccessToken)
.Build();

1 Like