public PagSeguroResult CreditCheckout(Credit credit) { PagSeguroConfiguration.UrlXmlConfiguration = this.configuration; bool isSandbox = true; EnvironmentConfiguration.ChangeEnvironment(isSandbox); // Instantiate a new checkout CreditCardCheckout checkout = credit.MappingCreditCheckout(); try { AccountCredentials credentials = PagSeguroConfiguration.Credentials(isSandbox); Uol.PagSeguro.Domain.Transaction transaction = TransactionService.CreateCheckout(credentials, checkout); if (!string.IsNullOrEmpty(transaction.Code)) { pagSeguroResult.Success = true; pagSeguroResult.Code = transaction.Code; pagSeguroResult.FeeAmount = transaction.FeeAmount; pagSeguroResult.NetAmount = transaction.NetAmount; pagSeguroResult.Reference = transaction.Reference; pagSeguroResult.TransactionStatus = transaction.TransactionStatus.ToString(); } return(pagSeguroResult); } catch (PagSeguroServiceException exception) { return(new PagSeguroResult() { Success = false }); //foreach (ServiceError element in exception.Errors) //{ // throw new System.ArgumentException(element.Message, "original"); //} } }
static void Main(string[] args) { PagSeguroConfiguration.XmlConfigFile = ".../.../.../.../.../Configuration/PagSeguroConfig.xml"; bool isSandbox = false; EnvironmentConfiguration.ChangeEnvironment(isSandbox); // Instantiate a new checkout CreditCardCheckout checkout = new CreditCardCheckout(); // Sets the payment mode checkout.PaymentMode = PaymentMode.DEFAULT; // Sets the receiver e-mail should will get paid checkout.ReceiverEmail = "*****@*****.**"; // Sets the currency checkout.Currency = Currency.Brl; // Add items checkout.Items.Add(new Item("0001", "Notebook Prata", 2, 2000.00m)); checkout.Items.Add(new Item("0002", "Notebook Rosa", 2, 150.99m)); // Sets a reference code for this checkout, it is useful to identify this payment in future notifications. checkout.Reference = "REF1234"; // Sets shipping information. checkout.Shipping = new Shipping(); checkout.Shipping.ShippingType = ShippingType.Sedex; checkout.Shipping.Cost = 0.00m; checkout.Shipping.Address = new Address( "BRA", "SP", "Sao Paulo", "Jardim Paulistano", "01452002", "Av. Brig. Faria Lima", "1384", "5o andar" ); // Sets shipping information. checkout.Billing = new Billing(); checkout.Billing.Address = new Address( "BRA", "SP", "Sao Paulo", "Jardim Paulistano", "01452002", "Av. Brig. Faria Lima", "1384", "5o andar" ); // Sets credit card holder information. checkout.Holder = new Holder( "Holder Name", new Phone("11", "56273440"), new HolderDocument(Documents.GetDocumentByType("CPF"), "12345678909"), "01/10/1980" ); // Sets your customer information. // If you using SANDBOX you must use an email @sandbox.pagseguro.com.br checkout.Sender = new Sender( "Joao Comprador", "*****@*****.**", new Phone("11", "56273440") ); checkout.Sender.Hash = "b2806d600653cbb2b195f317ca9a1a58738187a02c05bf7f2280e2076262e73b"; SenderDocument senderCPF = new SenderDocument(Documents.GetDocumentByType("CPF"), "12345678909"); checkout.Sender.Documents.Add(senderCPF); // Sets a credit card token. checkout.Token = "9a476b3a36124756a343712754638c7c"; //Sets the installments information checkout.Installment = new Installment(2, 25.00m, 2); // Sets the notification url checkout.NotificationUrl = "http://www.lojamodelo.com.br"; try { AccountCredentials credentials = PagSeguroConfiguration.GetAccountCredentials(isSandbox); Transaction result = TransactionService.CreateCheckout(credentials, checkout); } catch (PagSeguroServiceException exception) { foreach (ServiceError element in exception.Errors) { } } }
public CreditCardCheckout MappingCreditCheckout() { // Instantiate a new checkout CreditCardCheckout checkout = new CreditCardCheckout(); // Sets the payment mode checkout.PaymentMode = PaymentMode.DEFAULT; checkout.PaymentMethod = "creditCard"; // Sets the receiver e-mail should will get paid //checkout.ReceiverEmail = "*****@*****.**"; checkout.ReceiverEmail = "*****@*****.**"; // Sets the currency checkout.Currency = Currency.Brl; // Add items //foreach (var item in this.Items) //{ // checkout.Items.Add(new Uol.PagSeguro.Domain.Item(item.ProductId, item.Product, item.Quantity, Convert.ToDecimal(item.Value))); // checkout.Items.Add(new Item("0002", "Notebook Rosa", 2, 150.99m)); //} //foreach (var item in this.Items) //{ // checkout.Items.Add(new Uol.PagSeguro.Domain.Item(item.ProductId, item.Product, item.Quantity, Convert.ToDecimal(item.Value))); //} checkout.Items.Add(new Uol.PagSeguro.Domain.Item("2018", "Ticket Games", 1, Convert.ToDecimal(this.Parcel.Value * this.Parcel.Quantity))); // Sets a reference code for this checkout, it is useful to identify this payment in future notifications. checkout.Reference = this.OrderId.ToString(); // Sets shipping information. checkout.Shipping = new Shipping(); checkout.Shipping.ShippingType = ShippingType.Sedex; checkout.Shipping.Cost = 0.00m; checkout.Shipping.Address = new Address( "BRA", this.ShippingAddress.State, this.ShippingAddress.City, this.ShippingAddress.District, this.ShippingAddress.ZipCode, this.ShippingAddress.Street, this.ShippingAddress.Number, string.Empty ); // Sets shipping information. checkout.Billing = new Billing(); checkout.Billing.Address = new Address( "BRA", this.BillingAddress.State, this.BillingAddress.City, this.BillingAddress.District, this.BillingAddress.ZipCode, this.BillingAddress.Street, this.BillingAddress.Number, string.Empty ); // Sets credit card holder information. checkout.Holder = new Holder( this.CreditCardHolder.Name, new Phone(this.CreditCardHolder.DDD, this.CreditCardHolder.Phone), new HolderDocument(Documents.GetDocumentByType("CPF"), this.CreditCardHolder.CPF), this.CreditCardHolder.BirthDate.ToString("dd/MM/yyyy") //"01/10/1980" ); // Sets your customer information. // If you using SANDBOX you must use an email @sandbox.pagseguro.com.br checkout.Sender = new Sender( this.Buyer.Name, this.Buyer.Mail, new Phone(this.Buyer.DDD, this.Buyer.Phone) ); checkout.Sender.Hash = this.SenderHash; SenderDocument senderCPF = new SenderDocument(Documents.GetDocumentByType("CPF"), this.Buyer.CPF); checkout.Sender.Documents.Add(senderCPF); // Sets a credit card token. checkout.Token = this.CreditCardToken; //Sets the installments information checkout.Installment = new Uol.PagSeguro.Domain.Direct.Installment(this.Parcel.Quantity, Convert.ToDecimal(this.Parcel.Value), 12); // Sets the notification url checkout.NotificationURL = "https://ticketgames.com.br"; return(checkout); }
/// <summary> /// /// </summary> /// <param name="checkout"></param> /// <returns></returns> public static IDictionary <string, string> GetData(Checkout checkout) { IDictionary <string, string> data = new Dictionary <string, string>(); // payment mode if (checkout.PaymentMode != null) { data["paymentMode"] = checkout.PaymentMode; } // receiver e-mail if (checkout.ReceiverEmail != null) { data["receiverEmail"] = checkout.ReceiverEmail; } // reference if (checkout.Reference != null) { data["reference"] = checkout.Reference; } // sender if (checkout.Sender != null) { if (checkout.Sender.Name != null) { data["senderName"] = checkout.Sender.Name; } if (checkout.Sender.Email != null) { data["senderEmail"] = checkout.Sender.Email; } if (checkout.Sender.Hash != null) { data["senderHash"] = checkout.Sender.Hash; } // phone if (checkout.Sender.Phone != null) { if (checkout.Sender.Phone.AreaCode != null) { data["senderAreaCode"] = checkout.Sender.Phone.AreaCode; } if (checkout.Sender.Phone.Number != null) { data["senderPhone"] = checkout.Sender.Phone.Number; } } // documents if (checkout.Sender.Documents != null) { var documents = checkout.Sender.Documents; if (documents.Count == 1) { foreach (SenderDocument document in documents) { if (document != null) { if (document.Type.Equals("Cadastro de Pessoa Física")) { data["senderCPF"] = document.Value; } else { data["senderCNPJ"] = document.Value; } } } } } } // currency if (checkout.Currency != null) { data["currency"] = checkout.Currency; } // items if (checkout.Items.Count > 0) { var items = checkout.Items; int i = 0; foreach (Item item in items) { i++; if (item.Id != null) { data["itemId" + i] = item.Id; } if (item.Description != null) { data["itemDescription" + i] = item.Description; } if (item.Quantity != null) { data["itemQuantity" + i] = item.Quantity.ToString(); } if (item.Amount != null) { data["itemAmount" + i] = PagSeguroUtil.DecimalFormat(item.Amount); } if (item.Weight != null) { data["itemWeight" + i] = item.Weight.ToString(); } if (item.ShippingCost != null) { data["itemShippingCost" + i] = PagSeguroUtil.DecimalFormat((decimal)item.ShippingCost); } } } // extraAmount if (checkout.ExtraAmount != null) { data["extraAmount"] = PagSeguroUtil.DecimalFormat((decimal)checkout.ExtraAmount); } // shipping if (checkout.Shipping != null) { if (checkout.Shipping.ShippingType != null && checkout.Shipping.ShippingType.Value != null) { data["shippingType"] = checkout.Shipping.ShippingType.Value.ToString(); } if (checkout.Shipping.Cost != null) { data["shippingCost"] = PagSeguroUtil.DecimalFormat((decimal)checkout.Shipping.Cost); } // address if (checkout.Shipping.Address != null) { if (checkout.Shipping.Address.Street != null) { data["shippingAddressStreet"] = checkout.Shipping.Address.Street; } if (checkout.Shipping.Address.Number != null) { data["shippingAddressNumber"] = checkout.Shipping.Address.Number; } if (checkout.Shipping.Address.Complement != null) { data["shippingAddressComplement"] = checkout.Shipping.Address.Complement; } if (checkout.Shipping.Address.City != null) { data["shippingAddressCity"] = checkout.Shipping.Address.City; } if (checkout.Shipping.Address.State != null) { data["shippingAddressState"] = checkout.Shipping.Address.State; } if (checkout.Shipping.Address.District != null) { data["shippingAddressDistrict"] = checkout.Shipping.Address.District; } if (checkout.Shipping.Address.PostalCode != null) { data["shippingAddressPostalCode"] = checkout.Shipping.Address.PostalCode; } if (checkout.Shipping.Address.Country != null) { data["shippingAddressCountry"] = checkout.Shipping.Address.Country; } } } // maxAge if (checkout.MaxAge != null) { data["maxAge"] = checkout.MaxAge.ToString(); } // maxUses if (checkout.MaxUses != null) { data["maxUses"] = checkout.MaxUses.ToString(); } // notificationURL if (checkout.NotificationURL != null) { data["notificationURL"] = checkout.NotificationURL; } // metadata if (checkout.MetaData.Items.Count > 0) { int i = 0; var metaDataItems = checkout.MetaData.Items; foreach (MetaDataItem item in metaDataItems) { if (!PagSeguroUtil.IsEmpty(item.Key) && !PagSeguroUtil.IsEmpty(item.Value)) { i++; data["metadataItemKey" + i] = item.Key; data["metadataItemValue" + i] = item.Value; if (item.Group != null) { data["metadataItemGroup" + i] = item.Group.ToString(); } } } } // parameter if (checkout.Parameter.Items.Count > 0) { var parameterItems = checkout.Parameter.Items; foreach (ParameterItem item in parameterItems) { if (!PagSeguroUtil.IsEmpty(item.Key) && !PagSeguroUtil.IsEmpty(item.Value)) { if (item.Group != null) { data[item.Key + "" + item.Group] = item.Value; } else { data[item.Key] = item.Value; } } } } //Verify if exists the credit card checkout data if (checkout is CreditCardCheckout) { CreditCardCheckout creditcard = (CreditCardCheckout)checkout; // billing if (creditcard.Billing != null) { // address if (creditcard.Billing.Address != null) { if (creditcard.Billing.Address.Street != null) { data["billingAddressStreet"] = creditcard.Billing.Address.Street; } if (creditcard.Billing.Address.Number != null) { data["billingAddressNumber"] = creditcard.Billing.Address.Number; } if (creditcard.Billing.Address.Complement != null) { data["billingAddressComplement"] = creditcard.Billing.Address.Complement; } if (creditcard.Billing.Address.City != null) { data["billingAddressCity"] = creditcard.Billing.Address.City; } if (creditcard.Billing.Address.State != null) { data["billingAddressState"] = creditcard.Billing.Address.State; } if (creditcard.Billing.Address.District != null) { data["billingAddressDistrict"] = creditcard.Billing.Address.District; } if (creditcard.Billing.Address.PostalCode != null) { data["billingAddressPostalCode"] = creditcard.Billing.Address.PostalCode; } if (creditcard.Billing.Address.Country != null) { data["billingAddressCountry"] = creditcard.Billing.Address.Country; } } } // holder if (creditcard.Holder != null) { //holder name if (creditcard.Holder.Name != null) { data["creditCardHolderName"] = creditcard.Holder.Name; } //holder phone if (creditcard.Holder.Phone != null) { if (creditcard.Holder.Phone.AreaCode != null) { data["creditCardHolderAreaCode"] = creditcard.Holder.Phone.AreaCode; } if (creditcard.Holder.Phone.Number != null) { data["creditCardHolderPhone"] = creditcard.Holder.Phone.Number; } } //holder document if (creditcard.Holder.Document != null) { if (creditcard.Holder.Document.Value != null) { data["creditCardHolderCPF"] = creditcard.Holder.Document.Value; } } //holder birth date if (creditcard.Holder.Birthdate != null) { data["creditCardHolderBirthDate"] = creditcard.Holder.Birthdate; } } // token if (creditcard.Token != null) { data["creditCardToken"] = creditcard.Token; } // installment if (creditcard.Installment != null) { if (creditcard.Installment.Quantity > 0) { data["installmentQuantity"] = creditcard.Installment.Quantity.ToString(); } if (creditcard.Installment.Value > 0) { data["installmentValue"] = PagSeguroUtil.DecimalFormat((decimal)creditcard.Installment.Value); } if (creditcard.Installment.NoInterestInstallmentQuantity > 0) { data["noInterestInstallmentQuantity"] = creditcard.Installment.NoInterestInstallmentQuantity.ToString(); } } // payment method if (creditcard.PaymentMethod != null) { data["paymentMethod"] = creditcard.PaymentMethod; } } //Verify if exists the boleto checkout data if (checkout is BoletoCheckout) { BoletoCheckout boleto = (BoletoCheckout)checkout; // payment method if (boleto.PaymentMethod != null) { data["paymentMethod"] = boleto.PaymentMethod; } } //Verify if exists the online debit checkout data if (checkout is OnlineDebitCheckout) { OnlineDebitCheckout onlineDebit = (OnlineDebitCheckout)checkout; // payment method if (onlineDebit.PaymentMethod != null) { data["paymentMethod"] = onlineDebit.PaymentMethod; } // bank name if (onlineDebit.BankName != null) { data["bankName"] = onlineDebit.BankName; } } return(data); }
static void Main(string[] args) { PagSeguroConfiguration.UrlXmlConfiguration = ".../.../.../.../.../Configuration/PagSeguroConfig.xml"; bool isSandbox = false; EnvironmentConfiguration.ChangeEnvironment(isSandbox); // Instantiate a new checkout CreditCardCheckout checkout = new CreditCardCheckout(); // Sets the payment mode checkout.PaymentMode = PaymentMode.DEFAULT; // Sets the receiver e-mail should will get paid checkout.ReceiverEmail = "*****@*****.**"; // Sets the currency checkout.Currency = Currency.Brl; // Add items checkout.Items.Add(new Item("0001", "Notebook Prata", 2, 2000.00m)); checkout.Items.Add(new Item("0002", "Notebook Rosa", 2, 150.99m)); // Sets a reference code for this checkout, it is useful to identify this payment in future notifications. checkout.Reference = "REF1234"; // Sets shipping information for this payment request checkout.Shipping = new Shipping(); checkout.Shipping.ShippingType = ShippingType.Sedex; checkout.Shipping.Cost = 0.00m; checkout.Shipping.Address = new Address( "BRA", "SP", "Sao Paulo", "Jardim Paulistano", "01452002", "Av. Brig. Faria Lima", "1384", "5o andar" ); // Sets your customer information. // If you using SANDBOX you must use an email @sandbox.pagseguro.com.br checkout.Sender = new Sender( "Joao Comprador", "*****@*****.**", new Phone("11", "56273440") ); SenderDocument senderCPF = new SenderDocument(Documents.GetDocumentByType("CPF"), "12345678909"); checkout.Sender.Documents.Add(senderCPF); // Sets credit card token. checkout.Token = "1f31f3de024e4e5f8539d84cbc8b2a49"; //Sets installments information checkout.Installment = new Installment(1, 50.00m); // Sets the url used by PagSeguro for redirect user after ends checkout process checkout.NotificationURL = "http://www.lojamodelo.com.br"; try { AccountCredentials credentials = PagSeguroConfiguration.Credentials(isSandbox); Transaction result = TransactionService.CreateCheckout(credentials, checkout); Console.WriteLine(result); Console.ReadKey(); } catch (PagSeguroServiceException exception) { Console.WriteLine(exception.Message + "\n"); foreach (ServiceError element in exception.Errors) { Console.WriteLine(element + "\n"); } Console.ReadKey(); } }
public DonationMutationGraph() { FieldAsync <NonNullGraphType <StringGraphType>, string>( "initializeCreditCardCheckout", arguments: new QueryArguments(new QueryArgument <NonNullGraphType <CreditCardCheckoutInputGraph> >() { Name = "checkout" }), resolve: c => { CreditCardCheckout checkout = c.GetArgument <CreditCardCheckout>("checkout"); var provider = c.GetUserContext().ServiceProvider; return(provider.GetRequiredService <IDonationService>() .InitializeCreditCardCheckout(checkout, c.CancellationToken)); }); FieldAsync <NonNullGraphType <StringGraphType>, string>( "initializeSepaDirect", arguments: new QueryArguments(new QueryArgument <NonNullGraphType <SepaDirectCheckoutInputGraph> >() { Name = "checkout" }), resolve: async c => { SepaDirectCheckout checkout = c.GetArgument <SepaDirectCheckout>("checkout"); var provider = c.GetUserContext().ServiceProvider; await provider.GetRequiredService <IDonationService>() .InitializeSepaDirect(checkout, c.CancellationToken) .ConfigureAwait(false); return(checkout.SourceId); }); FieldAsync <NonNullGraphType <StringGraphType>, string>( "initializeIDealCheckout", arguments: new QueryArguments(new QueryArgument <NonNullGraphType <IDealCheckoutInputGraph> >() { Name = "checkout" }), resolve: async c => { IDealCheckout checkout = c.GetArgument <IDealCheckout>("checkout"); var provider = c.GetUserContext().ServiceProvider; await provider.GetRequiredService <IDonationService>() .InitializeIDealCheckout(checkout, c.CancellationToken) .ConfigureAwait(false); return(checkout.SourceId); }); FieldAsync <NonNullGraphType <StringGraphType>, string>( "cancelSubscription", arguments: new QueryArguments( new QueryArgument <NonNullGraphType <IdGraphType> >() { Name = "subscriptionId" }), resolve: async c => { string subscriptionId = c.GetArgument <string>("subscriptionId"); var context = c.GetUserContext(); await context.ServiceProvider .GetRequiredService <IDonationService>() .CancelSubscription(subscriptionId, context.User, c.CancellationToken) .ConfigureAwait(false); return(subscriptionId); }); }
/* * Here we're initializing a stripe checkout session for paying with a credit card. The upcoming SCA regulations ensure we have to do it through this API, because it's the only one that /easily/ supports things like 3D secure. */ public async Task <string> InitializeCreditCardCheckout(CreditCardCheckout checkout, CancellationToken token) { IEnumerable <ValidationResult> validationResults = ValidationHelper.Validate(checkout, serviceProvider); if (validationResults.Any()) { throw new InvalidOperationException(string.Join(",", validationResults.Select(v => $"{string.Join(", ", v.MemberNames)}: {v.ErrorMessage}"))); } ApplicationUser user = await userManager.FindByEmailAsync(checkout.Email).ConfigureAwait(false); var sessionOptions = new SessionCreateOptions() { SuccessUrl = checkout.SuccessUrl, CancelUrl = checkout.CancelUrl, PaymentMethodTypes = new List <string> { "card", } }; if (checkout.Recurring) { logger.LogInformation("Initializing recurring credit card checkout session"); sessionOptions.CustomerEmail = checkout.Email; // TODO: sessionOptions.CustomerId = customer.Id; // Once supported sessionOptions.SubscriptionData = new SessionSubscriptionDataOptions() { Items = new List <SessionSubscriptionDataItemOptions>() { new SessionSubscriptionDataItemOptions() { PlanId = (await CreateRecurringPlan(checkout.Amount, checkout.Currency, token).ConfigureAwait(false)).Id, Quantity = 1 } } }; } else { logger.LogInformation("Initializing credit card checkout session"); Customer customer = await GetOrCreateCustomer(checkout.Name, checkout.Email, token).ConfigureAwait(false); sessionOptions.CustomerId = customer.Id; sessionOptions.LineItems = new List <SessionLineItemOptions>() { new SessionLineItemOptions() { Amount = checkout.Amount * 100, Currency = checkout.Currency, Name = "donation", Description = "A donation to Stichting CollAction", Quantity = 1 } }; } Session session = await sessionService.CreateAsync(sessionOptions, cancellationToken : token).ConfigureAwait(false); context.DonationEventLog.Add(new DonationEventLog(eventData: session.ToJson(), type: DonationEventType.Internal, userId: user?.Id)); await context.SaveChangesAsync(token).ConfigureAwait(false); logger.LogInformation("Done initializing credit card checkout session"); return(session.Id); }
public string teste(string teste) { string conteudoChamada = teste; PagSeguroConfiguration.UrlXmlConfiguration = "/Users/vinic/source/repos/PiovezanaTCC/Piovezana.Api/bin/Debug/netcoreapp2.0/PagSeguroConfig.xml"; bool isSandbox = false; EnvironmentConfiguration.ChangeEnvironment(isSandbox); // Instantiate a new checkout CreditCardCheckout checkout = new CreditCardCheckout(); // Sets the payment mode checkout.PaymentMode = PaymentMode.DEFAULT; // Sets the receiver e-mail should will get paid checkout.ReceiverEmail = "*****@*****.**"; // Sets the currency checkout.Currency = Currency.Brl; // Add items checkout.Items.Add(new Item("0001", "Notebook Prata", 2, 2000.00m)); checkout.Items.Add(new Item("0002", "Notebook Rosa", 2, 150.99m)); // Sets a reference code for this checkout, it is useful to identify this payment in future notifications. checkout.Reference = "REF1234"; // Sets shipping information. checkout.Shipping = new Shipping(); checkout.Shipping.ShippingType = ShippingType.Sedex; checkout.Shipping.Cost = 0.00m; checkout.Shipping.Address = new Address( "BRA", "SP", "Sao Paulo", "Jardim Paulistano", "01452002", "Av. Brig. Faria Lima", "1384", "5o andar" ); // Sets shipping information. checkout.Billing = new Billing(); checkout.Billing.Address = new Address( "BRA", "SP", "Sao Paulo", "Jardim Paulistano", "01452002", "Av. Brig. Faria Lima", "1384", "5o andar" ); // Sets credit card holder information. checkout.Holder = new Holder( "Holder Name", new Phone("11", "56273440"), new HolderDocument(Documents.GetDocumentByType("CPF"), "12345678909"), "01/10/1980" ); // Sets your customer information. // If you using SANDBOX you must use an email @sandbox.pagseguro.com.br checkout.Sender = new Sender( "Joao Comprador", "*****@*****.**", new Phone("11", "56273440") ); checkout.Sender.Hash = "b2806d600653cbb2b195f317ca9a1a58738187a02c05bf7f2280e2076262e73b"; SenderDocument senderCPF = new SenderDocument(Documents.GetDocumentByType("CPF"), "12345678909"); checkout.Sender.Documents.Add(senderCPF); // Sets a credit card token. checkout.Token = "9a476b3a36124756a343712754638c7c"; //Sets the installments information checkout.Installment = new Installment(2, 25.00m, 2); // Sets the notification url checkout.NotificationURL = "http://www.lojamodelo.com.br"; try { AccountCredentials credentials = PagSeguroConfiguration.Credentials(isSandbox); Transaction result = TransactionService.CreateCheckout(credentials, checkout); Console.WriteLine(result); Console.ReadKey(); } catch (PagSeguroServiceException exception) { Console.WriteLine(exception.Message + "\n"); foreach (ServiceError element in exception.Errors) { Console.WriteLine(element + "\n"); } Console.ReadKey(); } return(null); }