public async Task CreatePayment() { var logger = ServiceScope.ServiceProvider.GetService <ILogger <SquareTest> >(); var squareCustomerReference = CreateSquareCustomerReference.FromTimestamp(GetUniqueNow()); var squareCustomerId = await SquareMicroService.AllocateSquareCustomerAsync(squareCustomerReference); logger.LogInformation($"Square customer ID = {squareCustomerId}"); var squarePaymentReference = CreateSquarePaymentReference.FromTimestamp(GetUniqueNow()); var squarePaymentId = await SquareMicroService.AllocateSquarePaymentAsync(squarePaymentReference, squareCustomerId); logger.LogInformation($"Square payment ID = {squarePaymentId}"); var squareWebPaymentTransactionId = await SquareMicroService.CreateSquareWebPaymentRequestAsync(squarePaymentId, 100m, "cnon:card-nonce-ok"); var paymentResponse = await SquareMicroService.ProcessWebPaymentRequestAsync(squareWebPaymentTransactionId); logger.LogInformation($"Square payment response = {paymentResponse}"); //var squareRefundTransactionId = await SquareMicroService.CreateSquareRefundTransactionAsync(squarePaymentId, 25m); //var refundResponse = await SquareMicroService.ProcessSquarePaymentTransactionAsync(squareRefundTransactionId); //logger.LogInformation($"Square refund response = {refundResponse}"); _ = await SquareMicroService.ProcessEventsAsync(); }