1
Hi I already searched everywhere and I couldn’t find how to integrate a subscription inside my system in Asp.net mvc with pagseguro. I used this code and my return is not working when I add this preapproval !
//**********************Inicio do procedimento para gerar uma compra pela API do pagseguro
DateTime now = new DateTime();
var payment = new PaymentRequest();
payment.Items.Add(new Item("0001", "Notebook Prata", 1, 2430.00m));
payment.Items.Add(new Item("0002", "Mochila", 1, 150.99m));
payment.Sender = new Sender("José Comprador","[email protected]",new Phone("11","56273440"));
payment.PreApproval = new PreApproval
{
Charge = Charge.Auto,
Name = "Seguro contra roubo do Notebook",
AmountPerPayment = 100.00m,
MaxAmountPerPeriod = 100.00m,
Details = string.Format("test"),
Period = Period.Monthly,
DayOfMonth = now.Day,
InitialDate = now,
FinalDate = now.AddMonths(6),
MaxTotalAmount = 600.00m,
MaxPaymentsPerPeriod = 1,
};
payment.Currency = Currency.Brl;
SenderDocument senderCPF = new SenderDocument(Documents.GetDocumentByType("CPF"), "12345678909");
payment.Sender.Documents.Add(senderCPF);
AccountCredentials credentials = new AccountCredentials("[email protected]","ABC1234DEF");
Uri paymentRedirectUri = payment.Register(credentials);
return Redirect(paymentRedirectUri.AbsoluteUri);
//**************************************************************************
I’ve already looked at the method of @Ciganomorissonmendez that I help a lot but it is my first project and I have no concept on the subject.