GithubHelp home page GithubHelp logo

isabella232 / sdk-dotnet Goto Github PK

View Code? Open in Web Editor NEW

This project forked from mercadopago/sdk-dotnet

0.0 0.0 0.0 2.21 MB

Mercado Pago's Official .Net SDK

Home Page: https://developers.mercadopago.com/

License: MIT License

C# 100.00%

sdk-dotnet's Introduction

Mercado Pago .Net

Portuguese / Spanish

CI NuGet Download count APM

The official Mercado Pago .NET SDK.

๐Ÿ’ก Requirements

.NET Standard 2.0+, .NET Core 2.0+, and .NET Framework 4.6.1+.

If you are using previous versions of .NET Framework in your project, please refer to the older versions of the SDK.

๐Ÿ“ฒ Installation

dotnet add package mercadopago-sdk
nuget install mercadopago-sdk

Using the Package Manager

Install-Package mercadopago-sdk

From Visual Studio

  1. Open the Solution Explorer.
  2. Right-click on a project within your solution.
  3. Click on Manage NuGet Packages....
  4. Click on the Browse tab and search for "mercadopago-sdk".
  5. Click on the mercadopago-sdk package, select the appropriate version and click Install.

๐ŸŒŸ Getting Started

First time using Mercado Pago? Create your Mercado Pago account.

Copy your Access Token in the credentials panel and replace the text YOUR_ACCESS_TOKEN with it.

Simple usage

To generate a card token read the Checkout API documentation.

using System;
using System.Threading.Tasks;
using MercadoPago.Client.Payment;
using MercadoPago.Config;
using MercadoPago.Resource.Payment;

MercadoPagoConfig.AccessToken = "YOUR_ACCESS_TOKEN";

var request = new PaymentCreateRequest
{
    TransactionAmount = 10,
    Token = "CARD_TOKEN",
    Description = "Payment description",
    Installments = 1,
    PaymentMethodId = "visa",
    Payer = new PaymentPayerRequest
    {
        Email = "[email protected]",
    }
};

var client = new PaymentClient();
Payment payment = await client.CreateAsync(request);

Console.WriteLine($"Payment ID: {payment.Id}");

Per-request configuration

All methods that make API calls accept an optional RequestOptions object. This can be used to configure some special options of the request, such as changing credentials or custom headers.

using MercadoPago.Client;

var requestOptions = new RequestOptions();
requestOptions.AccessToken = "YOUR_ACCESS_TOKEN";
// ...

var client = new PaymentClient();
Payment payment = await client.CreateAsync(request, requestOptions);

Using a proxy server

using System.Net;
using System.Net.Http;
using MercadoPago.Config;
using MercadoPago.Http;

var handler = new HttpClientHandler
{
    Proxy = new WebProxy(proxyUrl),
    UseProxy = true,
};
var httpClient = new HttpClient(handler);
MercadoPagoConfig.HttpClient = new DefaultHttpClient(httpClient);

Configuring automatic retries

The SDK automatically retries requests on intermittent failures. The default max number of attempts is 2.

using MercadoPago.Config;
using MercadoPago.Http;

var retryStrategy = new DefaultRetryStrategy(5);
MercadoPagoConfig.RetryStrategy = retryStrategy;

๐Ÿ“š Documentation

Visit our Developer Site for further information regarding:

Check our SDK docs to explore all available functionalities.

๐Ÿค Contributing

All contributions are welcome, ranging from people wanting to triage issues, others wanting to write documentation, to people wanting to contribute code.

Please read and follow our contribution guidelines. Contributions not following this guidelines will be disregarded. The guidelines are in place to make all of our lives easier and make contribution a consistent process for everyone.

โค๏ธ Support

If you require technical support, please contact our support team at developers.mercadopago.com.

๐Ÿป License

MIT license. Copyright (c) 2021 - Mercado Pago / Mercado Libre
For more information, see the LICENSE file.

sdk-dotnet's People

Contributors

delias-silva avatar gdzachary avatar joelibaceta avatar hdlopez avatar victorgodinho-meli avatar mminestrelli avatar agustinfrancesconi avatar pachae avatar gzacharyktz avatar dkarasawa avatar dotfede avatar janee avatar matiasgualino avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.