@@ -47,7 +47,7 @@ Get an existent Checkout preference
4747::
4848
4949 def index(req, **kwargs):
50- preferenceResult = mp.get_preference ("PREFERENCE_ID")
50+ preferenceResult = mp.preference.get ("PREFERENCE_ID")
5151
5252 return json.dumps(preferenceResult, indent=4)
5353
@@ -68,7 +68,7 @@ Create a Checkout preference
6868 ]
6969 }
7070
71- preferenceResult = mp.create_preference (preference)
71+ preferenceResult = mp.preference.create (preference)
7272
7373 return json.dumps(preferenceResult, indent=4)
7474
@@ -89,7 +89,7 @@ Update an existent Checkout preference
8989 ]
9090 }
9191
92- preferenceResult = mp.update_preference (id, preference)
92+ preferenceResult = mp.preference.update (id, preference)
9393
9494 return json.dumps(preferenceResult, indent=4)
9595
@@ -107,7 +107,7 @@ Search for payments
107107 "external_reference": None
108108 }
109109
110- searchResult = mp.search_payment (filters)
110+ searchResult = mp.payment.search (filters)
111111
112112 return json.dumps(searchResult, indent=4)
113113
@@ -121,7 +121,7 @@ Get payment data
121121
122122 def index(req, **kwargs):
123123 mp = mercadopago.MP("CLIENT_ID", "CLIENT_SECRET")
124- paymentInfo = mp.get_payment (kwargs["id"])
124+ paymentInfo = mp.payment.get (kwargs["id"])
125125
126126 if paymentInfo["status"] == 200:
127127 return json.dumps(paymentInfo, indent=4)
@@ -134,7 +134,7 @@ Cancel (only for pending payments)
134134::
135135
136136 def index(req, **kwargs):
137- result = mp.cancel_payment ("ID")
137+ result = mp.payment.cancel ("ID")
138138
139139 // Show result
140140 return json.dumps(result, indent=4)
@@ -146,7 +146,7 @@ Refund (only for accredited payments)
146146::
147147
148148 def index(req, **kwargs):
149- result = mp.refund_payment ("ID")
149+ result = mp.payment.get_refund ("ID")
150150
151151 // Show result
152152 return json.dumps(result, indent=4)
@@ -177,21 +177,21 @@ Create payment
177177
178178::
179179
180- mp.post ("/v1/payments", payment_data)
180+ mp.genericcall. post("/v1/payments", payment_data)
181181
182182Create customer
183183~~~~~~~~~~~~~~~
184184
185185::
186186
187- mp.post ("/v1/customers", {"email": "email@test.com"})
187+ mp.genericcall. post("/v1/customers", {"email": "email@test.com"})
188188
189189Get customer
190190~~~~~~~~~~~~
191191
192192::
193193
194- mp.get ("/v1/customers/CUSTOMER_ID")
194+ mp.genericcall. get("/v1/customers/CUSTOMER_ID")
195195
196196* View more Custom checkout related APIs in Developers Site
197197 * Argentina: `https://www.mercadopago.com.ar/developers <https://www.mercadopago.com.ar/developers >`_
@@ -208,22 +208,22 @@ You can access any other resource from the MercadoPago API using the generic met
208208::
209209
210210 // Get a resource, with optional URL params. Also you can disable authentication for public APIs
211- mp.get ("/resource/uri", [params], [authenticate=true]);
211+ mp.genericcall. get("/resource/uri", [params], [authenticate=true]);
212212
213213 // Create a resource with "data" and optional URL params.
214- mp.post ("/resource/uri", data, [params]);
214+ mp.genericcall. post("/resource/uri", data, [params]);
215215
216216 // Update a resource with "data" and optional URL params.
217- mp.put ("/resource/uri", data, [params]);
217+ mp.genericcall. put("/resource/uri", data, [params]);
218218
219219 // Delete a resource with optional URL params.
220- mp.delete ("/resource/uri", [params]);
220+ mp.genericcall. delete("/resource/uri", [params]);
221221
222222For example, if you want to get the Sites list (no params and no authentication):
223223
224224::
225225
226- result = mp.get ("/sites", null, false);
226+ result = mp.genericcall. get("/sites", null, false);
227227
228228 print (json.dumps(result, indent=4))
229229
0 commit comments