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(); } }
private static void Main(string[] args) { bool isSandbox = false; EnvironmentConfiguration.ChangeEnvironment(isSandbox); string nofiticationCode = "B071CC714E044E04389CC4606FBEFAA3A1BD"; try { ApplicationCredentials credentials = PagSeguroConfiguration.ApplicationCredentials(isSandbox); // TODO: Substitute the code below with a notification code for your authorization. // You receive this notification code through a post on the URL that you specify AuthorizationSummary authorization = NotificationService.CheckAuthorization(credentials, nofiticationCode); Console.WriteLine(authorization); Console.ReadKey(); } catch (PagSeguroServiceException exception) { Console.WriteLine(exception.Message + "\n"); foreach (ServiceError element in exception.Errors) { Console.WriteLine(element + "\n"); } Console.ReadKey(); } }
private static void Main(string[] args) { bool isSandbox = false; EnvironmentConfiguration.ChangeEnvironment(isSandbox); AuthorizationRequest authorization = new AuthorizationRequest { Reference = "REF1234", RedirectURL = "http://www.lojamodelo.com.br/redirect", NotificationURL = "http://www.lojamodelo.com.br/notification" }; authorization.addPermission(PermissionType.CREATE_CHECKOUTS); authorization.addPermission(PermissionType.DIRECT_PAYMENT); authorization.addPermission(PermissionType.MANAGE_PAYMENT_PRE_APPROVALS); authorization.addPermission(PermissionType.RECEIVE_TRANSACTION_NOTIFICATIONS); authorization.addPermission(PermissionType.SEARCH_TRANSACTIONS); try { ApplicationCredentials credentials = PagSeguroConfiguration.ApplicationCredentials(isSandbox); string result = authorization.Register(credentials); Console.WriteLine("URL da autorização: " + 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(); } }
static void Main(string[] args) { bool isSandbox = false; EnvironmentConfiguration.ChangeEnvironment(isSandbox); // TODO: Substitute the code below with a valid date interval for your authorization DateTime initialDate = new DateTime(2015, 09, 01, 08, 50, 0); DateTime finalDate = new DateTime(2015, 09, 24, 08, 50, 0); int maxPageResults = 10; int pageNumber = 1; try { ApplicationCredentials credentials = PagSeguroConfiguration.ApplicationCredentials(isSandbox); AuthorizationSearchResult result = AuthorizationSearchService.SearchByDate(credentials, initialDate, finalDate, pageNumber, maxPageResults); 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(); } }