This library provides developers with a simple set of bindings to the Mercado Pago API.
3.5 .Net Framework or Major
Using Package Manager
PM> Install-Package mercadopago-sdk -Version 1.0.56
Using .Net CLI
> dotnet add package mercadopago-sdk --version 1.0.56
Using Packet CLI
> paket add mercadopago-sdk --version 1.0.56
using MercadoPago;
For Web-checkout:
MercadoPago.SDK.ClientId = "YOUR_CLIENT_ID";
MercadoPago.SDK.ClientSecret = "YOUR_CLIENT_SECRET";
For API or custom checkout:
MercadoPago.SDK.AccessToken = "YOUR_ACCESS_TOKEN";
You can interact with all the resources available in the public API, to this each resource is represented by classes according to the following diagram:
Sample (Creating a Payment)
using MercadoPago;
using MercadoPago.Resources;
using MercadoPago.DataStructures.Payment;
using MercadoPago.Common;
MercadoPago.SDK.ClientSecret = "YOUR_ACCESS_TOKEN";
Payment payment = new Payment
{
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);
Error response structure
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
Write us at developers.mercadopago.com