Skip to content

High-Core/mercadopago-sdk-dotnet

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

55 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

MercadoPago SDK module for Payments integration

Usage:

  1. Copy bin/mercadopago.dll to your project desired folder.
using mercadopago;

MP mp = new MP ("CLIENT_ID", "CLIENT_SECRET");

Get your Access Token:

String accessToken = mp.getAccessToken();

Response.Write(accessToken);

Using MercadoPago Checkout

Get an existent Checkout preference:

Hashtable preference = mp.getPreference("PREFERENCE_ID");

Response.Write(preference);

Create a Checkout preference:

Hashtable preference = mp.createPreference("{\"items\":[{\"title\":\"sdk-dotnet\",\"quantity\":1,\"currency_id\":\"ARS\",\"unit_price\":10.5}]}");

Response.Write(preference);

Others items to use

Update an existent Checkout preference:

Hashtable preference = mp.updatePreference("PREFERENCE_ID", "{\"items\":[{\"title\":\"sdk-dotnet\",\"quantity\":1,\"currency_id\":\"USD\",\"unit_price\":2}]}");

Response.Write(preference);

Using MercadoPago Payment

Searching:

// Sets the filters you want
Dictionary<String, String> filters = new Dictionary<String, String> ();
    filters.Add("site_id", "MLA"); // Argentina: MLA; Brasil: MLB; Mexico: MLM; Venezuela: MLV; Colombia: MCO
    filters.Add("external_reference", "Bill001");
      
// Search payment data according to filters
Hashtable searchResult = mp.searchPayment (filters);

foreach (Hashtable payment in searchResult.SelectToken ("response.results")) {
    Response.Write(payment["collection"]["id"]);
    Response.Write(payment["collection"]["status"]);
}

More search examples

Receiving IPN notification:

Hashtable payment_info = mp.getPaymentInfo("ID");

Response.Write(payment_info["response"]);

Cancel (only for pending payments):

Hashtable result = mp.cancelPayment("ID");

// Show result
Response.Write(result);

Refund (only for accredited payments):

Hashtable result = mp.refundPayment("ID");

// Show result
Response.Write(result);

About Cancel & Refund

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • C# 82.3%
  • Classic ASP 14.0%
  • PowerShell 3.7%