コード例 #1
0
        static void Main(string[] args)
        {
            bool isSandbox = false;

            EnvironmentConfiguration.ChangeEnvironment(isSandbox);

            // TODO: Substitute the code below with a valid preApproval code for your transaction
            String authorizationCode = "FD455B5830A54DD58669D361932870E4";

            try
            {
                ApplicationCredentials credentials = PagSeguroConfiguration.ApplicationCredentials(isSandbox);

                AuthorizationSummary result = AuthorizationSearchService.SearchByCode(credentials, authorizationCode);

                Console.WriteLine(result);
                Console.ReadKey();
            }
            catch (WebException exception)
            {
                Console.WriteLine(exception.Message + "\n");
                Console.ReadKey();
            }
            catch (PagSeguroServiceException exception)
            {
                Console.WriteLine(exception.Message + "\n");

                foreach (ServiceError element in exception.Errors)
                {
                    Console.WriteLine(element + "\n");
                }
                Console.ReadKey();
            }
        }
コード例 #2
0
        static void Main(string[] args)
        {
            bool isSandbox = false;

            EnvironmentConfiguration.ChangeEnvironment(isSandbox);

            // TODO: Substitute the code below with a valid preApproval code for your transaction
            String authorizationCode = "(ADD-TOKEN-HERE)";

            try
            {
                ApplicationCredentials credentials = PagSeguroConfiguration.GetApplicationCredentials(isSandbox);

                AuthorizationSummary result = AuthorizationSearchService.SearchByCode(credentials, authorizationCode);
            }
            catch (WebException exception)
            {
            }
            catch (PagSeguroServiceException exception)
            {
                foreach (ServiceError element in exception.Errors)
                {
                }
            }
        }