I'm using MercadoPago SDK and trying to create a PreapprovalCreateRequest but I'm receiving this error:
Microsoft.AspNetCore.Diagnostics.DeveloperExceptionPageMiddleware: Error: An unhandled exception has occurred while executing the request.
MercadoPago.Error.MercadoPagoApiException: Error response from API. | Status code: 400 | API message: Invalid request data
This is the code I'm currently using:
PreapprovalCreateRequest paymentRequest = new PreapprovalCreateRequest
{
ExternalReference = codPagamento.ToString(),
BackUrl = (siteAddress) + "/api/public/mercado-pago-webhook",
PayerEmail = usuario.Email,
Reason = "Teste Assinatura",
Status = "authorized",
AutoRecurring = new PreApprovalAutoRecurringCreateRequest
{
CurrencyId = "BRL",
Frequency = 1,
FrequencyType = "months",
TransactionAmount = pagamento.ValorBruto,
}
};
var requestOptions = new RequestOptions
{
AccessToken = mercadoPagoAccessToken
};
var payment = await new PreapprovalClient().CreateAsync(paymentRequest, requestOptions);