Skip to content

Commit 10509e4

Browse files
Release Version 1.1.1
1 parent 52ef8ba commit 10509e4

16 files changed

Lines changed: 262 additions & 694 deletions

PKG-INFO

Lines changed: 258 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,258 @@
1+
Metadata-Version: 1.1
2+
Name: mercadopago
3+
Version: 1.1.1
4+
Summary: Mercadopago SDK module for Payments integration
5+
Home-page: https://github.com/mercadopago/sdk-python
6+
Author: Horacio Casatti <horacio.casatti@mercadolibre.com>
7+
Author-email: horacio.casatti@mercadolibre.com
8+
License: UNKNOWN
9+
Description: MercadoPago SDK module for Payments integration
10+
===============================================
11+
12+
* `Install`_
13+
* `Basic checkout`_
14+
* `Customized checkout`_
15+
* `Generic methods`_
16+
17+
Install
18+
-------
19+
20+
On Python 2.x
21+
22+
``pip install mercadopago``
23+
24+
On Python 3.x
25+
26+
``pip3 install mercadopago``
27+
28+
Basic checkout
29+
--------------
30+
31+
Configure your credentials
32+
~~~~~~~~~~~~~~~~~~~~~~~~~~
33+
34+
- Get your **CLIENT_ID** and **CLIENT_SECRET** in the following address:
35+
- Argentina: `https://www.mercadopago.com/mla/herramientas/aplicaciones <https://www.mercadopago.com/mla/herramientas/aplicaciones>`_
36+
- Brazil: `https://www.mercadopago.com/mlb/ferramentas/aplicacoes <https://www.mercadopago.com/mlb/ferramentas/aplicacoes>`_
37+
- México: `https://www.mercadopago.com/mlm/herramientas/aplicaciones <https://www.mercadopago.com/mlm/herramientas/aplicaciones>`_
38+
- Venezuela: `https://www.mercadopago.com/mlv/herramientas/aplicaciones <https://www.mercadopago.com/mlv/herramientas/aplicaciones>`_
39+
- Colombia: `https://www.mercadopago.com/mco/herramientas/aplicaciones <https://www.mercadopago.com/mco/herramientas/aplicaciones>`_
40+
- Chile: `https://www.mercadopago.com/mlc/herramientas/aplicaciones <https://www.mercadopago.com/mlc/herramientas/aplicaciones>`_
41+
42+
::
43+
44+
import mercadopago
45+
import json
46+
47+
mp = mercadopago.MP("CLIENT_ID", "CLIENT_SECRET")
48+
49+
Preferences
50+
~~~~~~~~~~~
51+
52+
Get an existent Checkout preference
53+
***********************************
54+
55+
::
56+
57+
def index(req, **kwargs):
58+
preferenceResult = mp.get_preference("PREFERENCE_ID")
59+
60+
return json.dumps(preferenceResult, indent=4)
61+
62+
Create a Checkout preference
63+
****************************
64+
65+
::
66+
67+
def index(req, **kwargs):
68+
preference = {
69+
"items": [
70+
{
71+
"title": "Test",
72+
"quantity": 1,
73+
"currency_id": "USD",
74+
"unit_price": 10.4
75+
}
76+
]
77+
}
78+
79+
preferenceResult = mp.create_preference(preference)
80+
81+
return json.dumps(preferenceResult, indent=4)
82+
83+
Update an existent Checkout preference
84+
**************************************
85+
86+
::
87+
88+
def index(req, **kwargs):
89+
preference = {
90+
"items": [
91+
{
92+
"title": "Test Modified",
93+
"quantity": 1,
94+
"currency_id": "USD",
95+
"unit_price": 20.4
96+
}
97+
]
98+
}
99+
100+
preferenceResult = mp.update_preference(id, preference)
101+
102+
return json.dumps(preferenceResult, indent=4)
103+
104+
Payments/Collections
105+
~~~~~~~~~~~~~~~~~~~~
106+
107+
Search for payments
108+
*******************
109+
110+
::
111+
112+
def index(req, **kwargs):
113+
filters = {
114+
"id": None,
115+
"external_reference": None
116+
}
117+
118+
searchResult = mp.search_payment(filters)
119+
120+
return json.dumps(searchResult, indent=4)
121+
122+
Get payment data
123+
****************
124+
125+
::
126+
127+
import mercadopago
128+
import json
129+
130+
def index(req, **kwargs):
131+
mp = mercadopago.MP("CLIENT_ID", "CLIENT_SECRET")
132+
paymentInfo = mp.get_payment (kwargs["id"])
133+
134+
if paymentInfo["status"] == 200:
135+
return json.dumps(paymentInfo, indent=4)
136+
else:
137+
return None
138+
139+
Cancel (only for pending payments)
140+
**********************************
141+
142+
::
143+
144+
def index(req, **kwargs):
145+
result = mp.cancel_payment("ID")
146+
147+
// Show result
148+
return json.dumps(result, indent=4)
149+
150+
151+
Refund (only for accredited payments)
152+
*************************************
153+
154+
::
155+
156+
def index(req, **kwargs):
157+
result = mp.refund_payment("ID")
158+
159+
// Show result
160+
return json.dumps(result, indent=4)
161+
162+
Customized checkout
163+
-------------------
164+
165+
166+
Configure your credentials
167+
~~~~~~~~~~~~~~~~~~~~~~~~~~
168+
169+
* Get your **ACCESS_TOKEN** in the following address:
170+
* Argentina: `https://www.mercadopago.com/mla/account/credentials <https://www.mercadopago.com/mla/account/credentials>`_
171+
* Brazil: `https://www.mercadopago.com/mlb/account/credentials <https://www.mercadopago.com/mlb/account/credentials>`_
172+
* Mexico: `https://www.mercadopago.com/mlm/account/credentials <https://www.mercadopago.com/mlm/account/credentials>`_
173+
* Venezuela: `https://www.mercadopago.com/mlv/account/credentials <https://www.mercadopago.com/mlv/account/credentials>`_
174+
* Colombia: `https://www.mercadopago.com/mco/account/credentials <https://www.mercadopago.com/mco/account/credentials>`_
175+
176+
::
177+
178+
import mercadopago
179+
import json
180+
181+
mp = mercadopago.MP("ACCESS_TOKEN")
182+
183+
Create payment
184+
~~~~~~~~~~~~~~
185+
186+
::
187+
188+
mp.post ("/v1/payments", payment_data)
189+
190+
Create customer
191+
~~~~~~~~~~~~~~~
192+
193+
::
194+
195+
mp.post ("/v1/customers", {"email": "email@test.com"})
196+
197+
Get customer
198+
~~~~~~~~~~~~
199+
200+
::
201+
202+
mp.get ("/v1/customers/CUSTOMER_ID")
203+
204+
* View more Custom checkout related APIs in Developers Site
205+
* Argentina: `https://www.mercadopago.com.ar/developers <https://www.mercadopago.com.ar/developers>`_
206+
* Brazil: `https://www.mercadopago.com.br/developers <https://www.mercadopago.com.br/developers>`_
207+
* Mexico: `https://www.mercadopago.com.mx/developers <https://www.mercadopago.com.mx/developers>`_
208+
* Venezuela: `https://www.mercadopago.com.ve/developers <https://www.mercadopago.com.ve/developers>`_
209+
* Colombia: `https://www.mercadopago.com.co/developers <https://www.mercadopago.com.co/developers>`_
210+
211+
Generic methods
212+
---------------
213+
214+
You can access any other resource from the MercadoPago API using the generic methods:
215+
216+
::
217+
218+
// Get a resource, with optional URL params. Also you can disable authentication for public APIs
219+
mp.get ("/resource/uri", [params], [authenticate=true]);
220+
221+
// Create a resource with "data" and optional URL params.
222+
mp.post ("/resource/uri", data, [params]);
223+
224+
// Update a resource with "data" and optional URL params.
225+
mp.put ("/resource/uri", data, [params]);
226+
227+
// Delete a resource with optional URL params.
228+
mp.delete ("/resource/uri", [params]);
229+
230+
For example, if you want to get the Sites list (no params and no authentication):
231+
232+
::
233+
234+
result = mp.get ("/sites", null, false);
235+
236+
print (json.dumps(result, indent=4))
237+
238+
Running tests
239+
-------------
240+
241+
On Python 2.x
242+
243+
``python setup.py test``
244+
245+
On Python 3.x
246+
247+
``python3 setup.py test``
248+
249+
Keywords: api mercadopago checkout payment ipn sdk integration
250+
Platform: UNKNOWN
251+
Classifier: Development Status :: 4 - Beta
252+
Classifier: Intended Audience :: Developers
253+
Classifier: Operating System :: OS Independent
254+
Classifier: Programming Language :: Python
255+
Classifier: Programming Language :: Python :: 2
256+
Classifier: Programming Language :: Python :: 3.4
257+
Classifier: Topic :: Software Development :: Libraries :: Python Modules
258+
Classifier: License :: Freely Distributable
-6 KB
Binary file not shown.

examples/checkout-buttons/basic-preference/button.py

Lines changed: 0 additions & 42 deletions
This file was deleted.

examples/instant-payment-notifications/receive-ipn.py

Lines changed: 0 additions & 29 deletions
This file was deleted.

examples/payment-search/search-approved-payments.py

Lines changed: 0 additions & 54 deletions
This file was deleted.

0 commit comments

Comments
 (0)