Quantcast
Viewing all articles
Browse latest Browse all 213

Mercado Pago .Net C#

estoy intentando desarrollar una aplicacion para leer codigo QR y pagar con Mercado Pago, queria saber si alguien sabe como en .net puedo enviar una peticion post con Headers ya que no puedo ... Ahi les pongo mi codigo:

    string Url = $"https://api.mercadopago.com/mpmobile/instore/qr/USER_ID/CAJA_ID";    var Client = new HttpClient();    CapaNegocios.Pagos.MPCheckout oTransaccion = new CapaNegocios.Pagos.MPCheckout()    {        sku_number = "12345",        category = "Categoria1",        title = "TiruloPrueba",        description = "DescripcionPrueba",        unit_price = 22,        quantity = 1,        unit_measure = "No se que es",        total_amount = 22                };    var Data = JsonSerializer.Serialize<CapaNegocios.Pagos.MPCheckout>(oTransaccion);    HttpContent contenido = new StringContent(Data, Encoding.UTF8,"application/json");    contenido.Headers.Add("Authorization", "Bearer MI_ACCESS_TOKEN");    contenido.Headers.Add("Content-Type", "application/json");    var httpResponse = await Client.PostAsync(Url, contenido);    if (httpResponse.IsSuccessStatusCode)    {        var Resultado =await httpResponse.Content.ReadAsStringAsync();    }

Y el error que me arroja es el siguiente:

: 'Misused header name, 'Authorization'. Make sure request headers are used with HttpRequestMessage, response headers with HttpResponseMessage, and content headers with HttpContent objects.'

Viewing all articles
Browse latest Browse all 213

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>