GithubHelp home page GithubHelp logo

fpanaccia / dx-dotnet Goto Github PK

View Code? Open in Web Editor NEW

This project forked from mercadopago/sdk-dotnet

1.0 1.0 1.0 443 KB

Mercado Pago's Official .Net SDK

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

License: MIT License

C# 100.00%

dx-dotnet's Introduction

Mercado Pago SDK for .Net

Build Status

This library provides developers with a simple set of bindings to the Mercado Pago API.

.Net versions supported:

3.5 .Net Framework or Major

Installation

Using our nuget package

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

Quick Start

1. You have to import the Mercado Pago SDK.

using MercadoPago;

2. Setup your credentials

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";

3. Using resource objects

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:

sdk resource structure

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 = "[email protected]"
    }
};

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 

Support

Write us at developers.mercadopago.com

dx-dotnet's People

Contributors

gdzachary avatar joelibaceta avatar hdlopez avatar pachae avatar mminestrelli avatar gzacharyktz avatar dotfede avatar janee avatar matiasgualino avatar

Stargazers

Poli avatar

Watchers

James Cloos avatar

Forkers

sindrunas

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.