Ejemplo n.º 1
0
        public static string GetPaymentInfo(string PaymentId)
        {
            try
            {
                string      to_return   = "";
                PaymentsApi PaymentsApi = new PaymentsApi();
                PaymentsApi.Configuration.AccessToken = PrivateValues.SquareAccessToken;
                PaymentsApi.Configuration.ApiClient   = new ApiClient(GetSquareApiUrl());
                var response = PaymentsApi.GetPayment(PaymentId);

                if (response.Payment != null && response.Payment.SourceType == "CARD")
                {
                    to_return = response.Payment.CardDetails.Card.CardBrand + "-" + response.Payment.CardDetails.Card.Last4;
                }

                return(to_return);
            }
            catch (Exception ex)
            {
                throw Utility.ThrowException(ex);
            }
        }