Skip to content

Commit 570cad3

Browse files
author
Sebastian Gun
committed
Examples cleaned. Deleted unnecessary imports and comments.
1 parent fd9a2d8 commit 570cad3

39 files changed

+79
-122
lines changed

README.md

+5
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,9 @@ Fully functional MercadoPago's integration code examples
66
Contents
77
--------
88

9+
* authentication - It is a service that allows you to safely access your account resources and information. Authentication is required to use any of MercadoPago's APIs.
910
* customized-checkout - It is a MercadoPago's integration service that allows you to receive payments in your site, and to control the buyer's user experience.
11+
* feeds - Feeds (IPN) is a message service that allows you to synchronize MercadoPago with your payment management system automatically. Additionally, you will be able to check payment status at all times.
12+
* movements - The API for movement search is a service that allows you to obtain information about a certain movement or multiple movements by applying different filters.
13+
* mp-checkout - Tutorial to create a button to receive payments from your users.
14+
* refund-and-cancellation - This service allows you to make a refund to your buyer or cancel payments.

authentication/asp/access_token.asp

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
<!--#include file="lib\mercadopago.asp"-->
2-
<!--#include file="lib\JSON_2.0.4.asp"-->
3-
<!--#include file="lib\json2.asp"-->
2+
43
<%
54
Dim mp
65
Dim accessToken

authentication/java/access_token.java

-3
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,5 @@
11
import mercadopago.MP;
22

3-
import org.codehaus.jettison.json.JSONException;
4-
import org.codehaus.jettison.json.JSONObject;
5-
63
public class MyClass {
74
public static void main (String args[]) {
85
MP mp = new MP ("CLIENT_ID", "CLIENT_SECRET");

authentication/python/access_token.py

+3-5
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,7 @@
11
import mercadopago
2-
import json
32

4-
def index(req, **kwargs):
5-
mp = mercadopago.MP("CLIENT_ID", "CLIENT_SECRET")
3+
mp = mercadopago.MP("CLIENT_ID", "CLIENT_SECRET")
64

7-
accessToken = mp.get_access_token()
5+
accessToken = mp.get_access_token()
86

9-
return accessToken
7+
print accessToken

customized-checkout/advanced-en.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ <h1><a href="http://developers.mercadopago.com/documentation/custom-checkout-adv
2727
</form>
2828

2929
<script type="text/javascript">
30-
<!-- Replace with your public_key -->
30+
/* Replace with your public_key */
3131
Checkout.setPublishableKey("00000000-1111-2222-3333-444444444444");
3232

3333
$("input[data-checkout='cardNumber']").bind("keyup",function(){

customized-checkout/advanced-es.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ <h1><a href="http://developers.mercadopago.com/documentacion/checkout-personaliz
2727
</form>
2828

2929
<script type="text/javascript">
30-
<!-- Reemplaza por tu public_key -->
30+
/* Reemplaza por tu public_key */
3131
Checkout.setPublishableKey("00000000-1111-2222-3333-444444444444");
3232

3333
$("input[data-checkout='cardNumber']").bind("keyup",function(){

customized-checkout/advanced-pt.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ <h1><a href="http://developers.mercadopago.com/documentation/custom-checkout-adv
2727
</form>
2828

2929
<script type="text/javascript">
30-
<!-- Troque com a sua public_key -->
30+
/* Troque com a sua public_key */
3131
Checkout.setPublishableKey("00000000-1111-2222-3333-444444444444");
3232

3333
$("input[data-checkout='cardNumber']").bind("keyup",function(){

customized-checkout/basic-en.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ <h1><a href="http://developers.mercadopago.com/documentation/custom-checkout?lan
2323
</form>
2424

2525
<script type="text/javascript">
26-
<!-- Replace with your public_key -->
26+
/* Replace with your public_key */
2727
Checkout.setPublishableKey("00000000-1111-2222-3333-444444444444");
2828

2929
$("#form-pay-mp").submit(function( event ) {

customized-checkout/basic-es.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ <h1><a href="http://developers.mercadopago.com/documentacion/checkout-personaliz
2323
</form>
2424

2525
<script type="text/javascript">
26-
<!-- Reemplaza por tu public_key -->
26+
/* Reemplaza por tu public_key */
2727
Checkout.setPublishableKey("00000000-1111-2222-3333-444444444444");
2828

2929
$("#form-pagar-mp").submit(function( event ) {

customized-checkout/basic-pt.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ <h1><a href="http://developers.mercadopago.com/documentation/custom-checkout?lan
2323
</form>
2424

2525
<script type="text/javascript">
26-
<!-- Troque com a sua public_key -->
26+
/* Troque com a sua public_key */
2727
Checkout.setPublishableKey("00000000-1111-2222-3333-444444444444");
2828

2929
$("#form-pagar-mp").submit(function( event ) {

customized-checkout/form.step_1.html

+2-1
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,10 @@
55
<title>Pay</title>
66
</head>
77
<body>
8-
<script src="//code.jquery.com/jquery-1.11.0.min.js"></script>
8+
<script src="https://code.jquery.com/jquery-1.11.0.min.js"></script>
99
<script type="text/javascript" src="https://secure.mlstatic.com/org-img/checkout/custom/1.0/checkout.js"></script>
1010
<script type="text/javascript">
11+
/* Replace with your public_key */
1112
Checkout.setPublishableKey("PUBLIC_KEY");
1213
</script>
1314
</body>

customized-checkout/payment/bash/create_payment.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ curl -X POST \
44
https://api.mercadolibre.com/checkout/custom/create_payment?access_token=tu_access_token \
55
-d '{
66
"amount": 10,
7-
"reason": "Título de lo que están pagando",
7+
"reason": "Title of what you are paying for",
88
"currency_id": "ARS",
99
"installments": 3,
1010
"payment_method_id": "visa",
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
{
2-
"payment_id" : Payment ID,
2+
"payment_id" : Payment_ID,
33
"status" : "Payment status",
44
"status_detail" : "Payment status detail",
55
"amount" : "10",
66
"reason": "Title of what you are paying for",
7-
"currency_id" : "USD",
7+
"currency_id" : "ARS",
88
"installments" : 3,
99
"payment_method_id" : "visa",
1010
"card_token_id" : "card_token",
11-
"payer_email" : "paymentcreation@mail.com",
11+
"payer_email" : "payer@email.com",
1212
"external_reference" : "1234",
1313
"statement_descriptor" : "MERCADOPAGO"
1414
}

feeds/receive_notification/java/payment.java

+3-4
Original file line numberDiff line numberDiff line change
@@ -4,18 +4,17 @@
44

55
import mercadopago.MP;
66

7-
import org.codehaus.jettison.json.JSONException;
87
import org.codehaus.jettison.json.JSONObject;
98

109
public class ReceiveFeed extends HttpServlet {
1110

1211
public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
1312
MP mp = new MP ("CLIENT_ID", "CLIENT_SECRET");
1413

15-
JSONObject payment_info = mp.getPaymentInfo(request.getParameter("id"));
14+
JSONObject paymentInfo = mp.getPaymentInfo(request.getParameter("id"));
1615

17-
if (Integer.parseInt (payment_info.get("status").toString()) == 200) {
18-
out.print(payment_info.get("response"));
16+
if (Integer.parseInt(paymentInfo.get("status").toString()) == 200) {
17+
out.print(paymentInfo.get("response"));
1918
}
2019
}
2120

feeds/receive_notification/nodejs/payment.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
var http = require("http"),
2-
url = require("url");
2+
url = require("url"),
3+
MP = require("mercadopago");
34

45
http.createServer(function (req, res) {
56
res.writeHead(200);

feeds/receive_notification/python/payment.py

-3
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,7 @@
11
# coding: UTF-8
2-
32
import os, sys
43
import mercadopago
54

6-
import json
7-
85
def index(req, **kwargs):
96
mp = mercadopago.MP("CLIENT_ID", "CLIENT_SECRET")
107

feeds/receive_notification/ruby/payment.rb

+1-4
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,11 @@
11
require 'rubygems'
22
require 'rack'
3-
43
require 'mercadopago.rb'
54

65
class IPN
76
def call(env)
87
mp = MercadoPago.new('CLIENT_ID', 'CLIENT_SECRET')
9-
10-
payment_info = mp.get_payment_info('ID');
11-
8+
payment_info = mp.get_payment_info('ID')
129
html = ""
1310

1411
if (payment_info['status'] == 200)
+1-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
curl -X GET \
22
-H 'accept: application/json' \
3-
'https://api.mercadolibre.com/mercadopago_account/movements/search?reference_id=payment_id?access_token=your_access_token'
3+
'https://api.mercadolibre.com/mercadopago_account/movements/search?reference_id=payment_id&access_token=your_access_token'

mp-checkout/basic/dotnet/payment_button.complete.aspx

+4-3
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,15 @@
11
<%@ Page Language="c#" %>
22
<%@ Import Namespace="mercadopago" %>
33
<%@ Import Namespace="System.Collections" %>
4+
45
<%
5-
MP mp = new MP ("CLIENT_ID", "CLIENT_SECRET");
6+
MP mp = new MP("CLIENT_ID", "CLIENT_SECRET");
67
78
String preferenceData = "{'items':"+
89
"[{"+
910
"'title':'Multicolor kite',"+
1011
"'quantity':1,"+
11-
"'currency_id':'USD',"+ // Available currencies at: https://api.mercadolibre.com/currencies
12+
"'currency_id':'USD',"+ <%-- Available currencies at: https://api.mercadolibre.com/currencies --%>
1213
"'unit_price':10.0"+
1314
"}]"+
1415
"}";
@@ -19,7 +20,7 @@
1920
<!DOCTYPE html>
2021
<html>
2122
<head>
22-
<title>MercadoPago SDK - Create Preference and Show Checkout Example</title>
23+
<title>Pay</title>
2324
</head>
2425
<body>
2526
<a href="<% Response.Write(preference["response"]["init_point"]); %>" name="MP-Checkout" class="blue-rn-m">Pay</a>

mp-checkout/basic/dotnet/payment_button.step_1.aspx

+2-9
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,9 @@
11
<%@ Page Language="c#" %>
22
<%@ Import Namespace="mercadopago" %>
33
<%@ Import Namespace="System.Collections" %>
4-
<%
5-
/* Get your credentials at:
6-
* Argentina: https://www.mercadopago.com/mla/herramientas/aplicaciones
7-
* Brazil: https://www.mercadopago.com/mlb/ferramentas/aplicacoes
8-
* Mexico: https://www.mercadopago.com/mlm/herramientas/aplicaciones
9-
* Venezuela: https://www.mercadopago.com/mlv/herramientas/aplicaciones
10-
* Colombia: https://www.mercadopago.com/mco/herramientas/aplicaciones
11-
*/
124

13-
MP mp = new MP ("CLIENT_ID", "CLIENT_SECRET");
5+
<%
6+
MP mp = new MP("CLIENT_ID", "CLIENT_SECRET");
147
%>
158

169
<!DOCTYPE html>

mp-checkout/basic/dotnet/payment_button.step_2.aspx

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,15 @@
11
<%@ Page Language="c#" %>
22
<%@ Import Namespace="mercadopago" %>
33
<%@ Import Namespace="System.Collections" %>
4+
45
<%
5-
MP mp = new MP ("CLIENT_ID", "CLIENT_SECRET");
6+
MP mp = new MP("CLIENT_ID", "CLIENT_SECRET");
67
78
String preferenceData = "{'items':"+
89
"[{"+
910
"'title':'Multicolor kite',"+
1011
"'quantity':1,"+
11-
"'currency_id':'USD',"+ // Available currencies at: https://api.mercadolibre.com/currencies
12+
"'currency_id':'USD',"+ <%-- Available currencies at: https://api.mercadolibre.com/currencies --%>
1213
"'unit_price':10.0"+
1314
"}]"+
1415
"}";

mp-checkout/basic/dotnet/payment_button.step_3.aspx

+4-3
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,15 @@
11
<%@ Page Language="c#" %>
22
<%@ Import Namespace="mercadopago" %>
33
<%@ Import Namespace="System.Collections" %>
4+
45
<%
5-
MP mp = new MP ("CLIENT_ID", "CLIENT_SECRET");
6+
MP mp = new MP("CLIENT_ID", "CLIENT_SECRET");
67
78
String preferenceData = "{'items':"+
89
"[{"+
910
"'title':'Multicolor kite',"+
1011
"'quantity':1,"+
11-
"'currency_id':'USD',"+ // Available currencies at: https://api.mercadolibre.com/currencies
12+
"'currency_id':'USD',"+ <%-- Available currencies at: https://api.mercadolibre.com/currencies --%>
1213
"'unit_price':10.0"+
1314
"}]"+
1415
"}";
@@ -19,7 +20,7 @@
1920
<!DOCTYPE html>
2021
<html>
2122
<head>
22-
<title>MercadoPago SDK - Create Preference and Show Checkout Example</title>
23+
<title>Pay</title>
2324
</head>
2425
<body>
2526
<a href="<% Response.Write(preference["response"]["init_point"]); %>">Pay</a>

mp-checkout/basic/java/payment_button.complete.jsp

+8-9
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,18 @@
11
<%@page contentType="text/html" pageEncoding="UTF-8"%>
2-
32
<%@page import="com.mercadopago.MP"%>
43
<%@page import="org.codehaus.jettison.json.JSONObject"%>
54

65
<%
7-
MP mp = new MP ("CLIENT_ID", "CLIENT_SECRET");
6+
MP mp = new MP("CLIENT_ID", "CLIENT_SECRET");
87
98
String preferenceData = "{'items':"+
10-
"[{"+
11-
"'title':'Multicolor kite',"+
12-
"'quantity':1,"+
13-
"'currency_id':'USD',"+ // Available currencies at: https://api.mercadolibre.com/currencies
14-
"'unit_price':10.0"+
15-
"}]"+
16-
"}";
9+
"[{"+
10+
"'title':'Multicolor kite',"+
11+
"'quantity':1,"+
12+
"'currency_id':'USD',"+ // Available currencies at: https://api.mercadolibre.com/currencies
13+
"'unit_price':10.0"+
14+
"}]"+
15+
"}";
1716
1817
JSONObject preference = mp.createPreference(preferenceData);
1918

mp-checkout/basic/java/payment_button.step_1.jsp

+1-10
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,9 @@
11
<%@page contentType="text/html" pageEncoding="UTF-8"%>
2-
32
<%@page import="com.mercadopago.MP"%>
43
<%@page import="org.codehaus.jettison.json.JSONObject"%>
54

65
<%
7-
/* Get your credentials at:
8-
* Argentina: https://www.mercadopago.com/mla/herramientas/aplicaciones
9-
* Brazil: https://www.mercadopago.com/mlb/ferramentas/aplicacoes
10-
* Mexico: https://www.mercadopago.com/mlm/herramientas/aplicaciones
11-
* Venezuela: https://www.mercadopago.com/mlv/herramientas/aplicaciones
12-
* Colombia: https://www.mercadopago.com/mco/herramientas/aplicaciones
13-
*/
14-
15-
MP mp = new MP ("CLIENT_ID", "CLIENT_SECRET");
6+
MP mp = new MP("CLIENT_ID", "CLIENT_SECRET");
167
%>
178

189
<!DOCTYPE html>

mp-checkout/basic/java/payment_button.step_2.jsp

+8-9
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,18 @@
11
<%@page contentType="text/html" pageEncoding="UTF-8"%>
2-
32
<%@page import="com.mercadopago.MP"%>
43
<%@page import="org.codehaus.jettison.json.JSONObject"%>
54

65
<%
7-
MP mp = new MP ("CLIENT_ID", "CLIENT_SECRET");
6+
MP mp = new MP("CLIENT_ID", "CLIENT_SECRET");
87
98
String preferenceData = "{'items':"+
10-
"[{"+
11-
"'title':'Multicolor kite',"+
12-
"'quantity':1,"+
13-
"'currency_id':'USD',"+ // Available currencies at: https://api.mercadolibre.com/currencies
14-
"'unit_price':10.0"+
15-
"}]"+
16-
"}";
9+
"[{"+
10+
"'title':'Multicolor kite',"+
11+
"'quantity':1,"+
12+
"'currency_id':'USD',"+ // Available currencies at: https://api.mercadolibre.com/currencies
13+
"'unit_price':10.0"+
14+
"}]"+
15+
"}";
1716
1817
JSONObject preference = mp.createPreference(preferenceData);
1918
%>

mp-checkout/basic/java/payment_button.step_3.jsp

+8-9
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,18 @@
11
<%@page contentType="text/html" pageEncoding="UTF-8"%>
2-
32
<%@page import="com.mercadopago.MP"%>
43
<%@page import="org.codehaus.jettison.json.JSONObject"%>
54

65
<%
7-
MP mp = new MP ("CLIENT_ID", "CLIENT_SECRET");
6+
MP mp = new MP("CLIENT_ID", "CLIENT_SECRET");
87
98
String preferenceData = "{'items':"+
10-
"[{"+
11-
"'title':'Multicolor kite',"+
12-
"'quantity':1,"+
13-
"'currency_id':'USD',"+ // Available currencies at: https://api.mercadolibre.com/currencies
14-
"'unit_price':10.0"+
15-
"}]"+
16-
"}";
9+
"[{"+
10+
"'title':'Multicolor kite',"+
11+
"'quantity':1,"+
12+
"'currency_id':'USD',"+ // Available currencies at: https://api.mercadolibre.com/currencies
13+
"'unit_price':10.0"+
14+
"}]"+
15+
"}";
1716
1817
JSONObject preference = mp.createPreference(preferenceData);
1918

0 commit comments

Comments
 (0)