MercadoPagoNetCore 1.0.10

dotnet add package MercadoPagoNetCore --version 1.0.10
NuGet\Install-Package MercadoPagoNetCore -Version 1.0.10
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="MercadoPagoNetCore" Version="1.0.10" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add MercadoPagoNetCore --version 1.0.10
#r "nuget: MercadoPagoNetCore, 1.0.10"
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install MercadoPagoNetCore as a Cake Addin
#addin nuget:?package=MercadoPagoNetCore&version=1.0.10

// Install MercadoPagoNetCore as a Cake Tool
#tool nuget:?package=MercadoPagoNetCore&version=1.0.10

Mercado-Pago-Net-Core

Migration from Mercado Pago SDK from Net Framework 3.5 to NetCore 2.1

Installation

Using our nuget package

Using Package Manager

PM> Install-Package Mercado-Pago-Net-Core -Version 1.0.10

1. You have to import the Mercado Pago SDK.

using MercadoPago;

2. Setup your credentials

For Web-checkout:

MercadoPago.SDK sdk = new MercadoPago.SDK();
sdk.ClientId = "YOUR_CLIENT_ID";
sdk.ClientSecret = "YOUR_CLIENT_SECRET";

For API or custom checkout:

MercadoPago.SDK sdk = new MercadoPago.SDK();
sdk.AccessToken = "YOUR_ACCESS_TOKEN";

Sample (Creating a Preference)

using MercadoPago;
using MercadoPago.Resources;
using MercadoPago.DataStructures.Preference;


MercadoPago.SDK sdk = new MercadoPago.SDK();
sdk.ClientId = "YOUR_CLIENT_ID";
sdk.ClientSecret = "YOUR_CLIENT_SECRET";

// Create a preference object
Preference preference = new Preference(sdk); 
# Adding an item object
preference.Items.Add(
  new Item()
  {
    Id = "1234",
    Title = "Synergistic Cotton Watch", 
    Quantity = 5,
    CurrencyId = "ARS",
    UnitPrice = (float)23.25
  }
);
// Setting a payer object as value for Payer property
preference.Payer = new Payer(){
  Email = "willa@yahoo.com"
}
// Save and posting preference
preference.Save();

Sample (Creating a Payment)

using MercadoPago;
using MercadoPago.Resources;
using MercadoPago.DataStructures.Payment;
using MercadoPago.Common;

MercadoPago.SDK sdk = new MercadoPago.SDK();
sdk.AccessToken = "YOUR_ACCESS_TOKEN";

Payment payment = new Payment(sdk)
{
    TransactionAmount = (float)100.0,
    Token = "YOUR_CARD_TOKEN"
    Description = "Ergonomic Silk Shirt",
    PaymentMethodId = "visa", 
    Installments = 1,
    Payer = new Payer {
        Email = "larue.nienow@hotmail.com"
    }
};

payment.Save();

Console.Out.WriteLine(payment.Status);

4. Handling Errors

Error response structure

errorstructure

You can check the errors and causes returned by the API using the errors attribute.

Console.Out.WriteLine(payment.Errors.Message) // Print the error Message 
Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 was computed.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed. 
.NET Core netcoreapp2.1 is compatible.  netcoreapp2.2 was computed.  netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
1.0.10 7,185 3/9/2019

Se arregló Bug causado por el uso de Reflexion