private static Payment NewPayment(bool capture) { var cardToken = new CardToken { CardId = "8940397939", CustomerId = "649457098-FybpOkG6zH8QRm", SecurityCode = "123", }; cardToken.Save(); return(new Payment { Payer = new Payer { Email = "*****@*****.**", Entity_type = EntityType.individual, Type = PayerType.customer, Id = "649457098-FybpOkG6zH8QRm", Identification = new Identification { Type = "CPF", Number = "19119119100", }, FirstName = "Test", LastName = "User", }, BinaryMode = false, Capture = capture, ExternalReference = Guid.NewGuid().ToString(), Description = "Payment description", Metadata = new JObject { { "key1", JToken.FromObject("value1") }, { "key2", JToken.FromObject("value2") }, }, TransactionAmount = 10, //PaymentMethodId = "master", Token = cardToken.Id, Installments = 1, StatementDescriptor = "STAT-DESC", NotificationUrl = "https://seu-site.com.br/webhooks", CallbackUrl = "https://seu-site.com.br/callbackurl", AdditionalInfo = new AdditionalInfo { IpAddress = "127.0.0.1", Items = new List <Item> { new Item { Id = "SKU-1", Title = "Product", PictureUrl = "https://www.mercadopago.com/org-img/MLB/design/2015/m_pago/logos/mp_processado_02.png", Description = "Product description", CategoryId = "cat", Quantity = 1, UnitPrice = 10, }, }, Payer = new AdditionalInfoPayer { FirstName = "Test", LastName = "User", RegistrationDate = DateTime.Now.AddDays(-30), Phone = new Phone { AreaCode = "11", Number = "999999999", }, Address = new Address { ZipCode = "0600000", StreetName = "Street", StreetNumber = 123, }, }, Shipments = new Shipment { ReceiverAddress = new ReceiverAddress { Zip_code = "0600000", StreetName = "Street", StreetNumber = 123, Apartment = "23", Floor = "First", }, }, }, }); }
private static AdvancedPayment NewAdvancedPayment(bool capture) { var cardToken = new CardToken { CardId = "8940397939", CustomerId = "649457098-FybpOkG6zH8QRm", SecurityCode = "123", }; cardToken.Save(); return(new AdvancedPayment { ApplicationId = "59441713004005", Payments = new List <AdvPayDS.Payment> { new AdvPayDS.Payment { PaymentMethodId = "master", PaymentTypeId = "credit_card", Token = cardToken.Id, DateOfExpiration = DateTime.UtcNow.Add(TimeSpan.FromDays(120)), TransactionAmount = 1000, Installments = 1, ProcessingMode = "aggregator", Description = "Payment", ExternalReference = "Test" + Guid.NewGuid().ToString(), StatementDescriptor = "ADVPAYTEST" }, }, Disbursements = new List <Disbursement> { new Disbursement { Amount = 400, ExternalReference = "Seller1" + Guid.NewGuid().ToString(), CollectorId = 539673000, ApplicationFee = 1, }, new Disbursement { Amount = 600, ExternalReference = "Seller2" + Guid.NewGuid().ToString(), CollectorId = 488656838, ApplicationFee = 0.5m, }, }, Payer = new AdvPayDS.Payer { Id = "649457098-FybpOkG6zH8QRm", Type = "customer", Email = "*****@*****.**", FirstName = "Test", LastName = "User", Address = new AdvPayDS.Address { ZipCode = "06233200", StreetName = "Street", StreetNumber = "120", }, Identification = new AdvPayDS.Identification { Type = "CPF", Number = "19119119100", }, }, ExternalReference = "ADV" + Guid.NewGuid().ToString(), Description = "Test", BinaryMode = false, Capture = capture, AdditionalInfo = new AdvPayDS.AdditionalInfo { IpAddress = "127.0.0.1", Payer = new AdvPayDS.AdditionalInfoPayer { FirstName = "Test", LastName = "User", RegistrationDate = DateTime.UtcNow.AddDays(-10), }, Items = new List <AdvPayDS.Item> { new AdvPayDS.Item { Id = "123", Title = "Title", PictureUrl = "https://www.mercadopago.com/logomp3.gif", Description = "Description", CategoryId = "Category", Quantity = 1, UnitPrice = 1000 }, }, Shipments = new AdvPayDS.Shipments { ReceiverAddress = new AdvPayDS.ReceiverAddress { ZipCode = "06233200", StreetName = "Street", StreetNumber = "120", Floor = "1", Apartment = "A", }, }, }, }); }