@@ -51,7 +51,7 @@ payment = client.create_payment(
5151 }]
5252)
5353
54- print (f " Payment created: { payment.ecommerce_id} " )
54+ print (f " Payment created: { payment.data. ecommerce_id} " )
5555print (" Customer will receive a push notification" )
5656```
5757
@@ -68,14 +68,14 @@ The customer needs to open their ATH Móvil app and approve the payment:
6868# Option 1: Automatic polling (recommended)
6969try :
7070 confirmed = client.wait_for_confirmation(
71- payment.ecommerce_id,
71+ payment.data. ecommerce_id,
7272 polling_interval = 2.0 , # Check every 2 seconds
7373 max_attempts = 150 # 5 minutes max (150 * 2s)
7474 )
7575 print (" Customer confirmed!" )
7676except TimeoutError :
7777 print (" Customer didn't confirm in time" )
78- client.cancel_payment(payment.ecommerce_id)
78+ client.cancel_payment(payment.data. ecommerce_id)
7979```
8080
8181``` python
@@ -86,7 +86,7 @@ max_wait = 300 # 5 minutes
8686elapsed = 0
8787
8888while elapsed < max_wait:
89- status = client.find_payment(payment.ecommerce_id)
89+ status = client.find_payment(payment.data. ecommerce_id)
9090
9191 if status.data.status == " CONFIRM" :
9292 print (" Customer confirmed!" )
@@ -118,7 +118,7 @@ Once confirmed, you must authorize to finalize:
118118
119119``` python
120120# Authorize completes the payment
121- result = client.authorize_payment(payment.ecommerce_id)
121+ result = client.authorize_payment(payment.data. ecommerce_id)
122122
123123print (f " Payment completed! " )
124124print (f " Reference number: { result.data.reference_number} " )
@@ -166,17 +166,17 @@ try:
166166 # Wait for confirmation
167167 try :
168168 confirmed = client.wait_for_confirmation(
169- payment.ecommerce_id,
169+ payment.data. ecommerce_id,
170170 max_attempts = 150
171171 )
172172 except TimeoutError :
173173 # Customer didn't confirm, clean up
174- client.cancel_payment(payment.ecommerce_id)
174+ client.cancel_payment(payment.data. ecommerce_id)
175175 print (" Payment cancelled due to timeout" )
176176 return
177177
178178 # Authorize
179- result = client.authorize_payment(payment.ecommerce_id)
179+ result = client.authorize_payment(payment.data. ecommerce_id)
180180 print (f " Success! Reference: { result.data.reference_number} " )
181181
182182except ValidationError as e:
@@ -221,23 +221,23 @@ def process_payment(amount: str, phone: str, order_id: str) -> str | None:
221221 ],
222222 )
223223
224- print (f " Payment created: { payment.ecommerce_id} " )
224+ print (f " Payment created: { payment.data. ecommerce_id} " )
225225 print (f " Waiting for customer { phone} to confirm... " )
226226
227227 # 2. Wait for customer confirmation (5 minute timeout)
228228 try :
229229 client.wait_for_confirmation(
230- payment.ecommerce_id,
230+ payment.data. ecommerce_id,
231231 polling_interval = 2.0 ,
232232 max_attempts = 150 # 5 minutes
233233 )
234234 except TimeoutError :
235235 print (" Customer didn't confirm in time, cancelling..." )
236- client.cancel_payment(payment.ecommerce_id)
236+ client.cancel_payment(payment.data. ecommerce_id)
237237 return None
238238
239239 # 3. Authorize payment
240- result = client.authorize_payment(payment.ecommerce_id)
240+ result = client.authorize_payment(payment.data. ecommerce_id)
241241
242242 print (f " Payment completed! " )
243243 print (f " Reference: { result.data.reference_number} " )
@@ -321,12 +321,12 @@ If the customer provides a different phone number:
321321``` python
322322# After payment creation, before confirmation
323323client.update_phone_number(
324- ecommerce_id = payment.ecommerce_id,
324+ ecommerce_id = payment.data. ecommerce_id,
325325 phone_number = " 7875559999"
326326)
327327
328328# Now wait for confirmation on the new number
329- client.wait_for_confirmation(payment.ecommerce_id)
329+ client.wait_for_confirmation(payment.data. ecommerce_id)
330330```
331331
332332## Common Patterns
@@ -339,15 +339,15 @@ If you don't want to poll, implement a customer redirect:
339339# 1. Create payment
340340payment = client.create_payment(... )
341341
342- # 2. Show customer a page with payment.ecommerce_id
342+ # 2. Show customer a page with payment.data. ecommerce_id
343343# Customer opens ATH Móvil app and confirms
344344
345345# 3. Customer returns to your site, you check status
346- status = client.find_payment(payment.ecommerce_id)
346+ status = client.find_payment(payment.data. ecommerce_id)
347347
348348if status.data.status == " CONFIRM" :
349349 # Authorize it
350- result = client.authorize_payment(payment.ecommerce_id)
350+ result = client.authorize_payment(payment.data. ecommerce_id)
351351```
352352
353353### Pattern: Background Job
@@ -357,8 +357,8 @@ For async frameworks:
357357``` python
358358# In request handler
359359payment = client.create_payment(... )
360- enqueue_job(" check_payment" , payment.ecommerce_id)
361- return {" payment_id" : payment.ecommerce_id}
360+ enqueue_job(" check_payment" , payment.data. ecommerce_id)
361+ return {" payment_id" : payment.data. ecommerce_id}
362362
363363# In background worker
364364def check_payment (ecommerce_id ):
0 commit comments