File size: 1,355 Bytes
7f9c0e7
 
 
7e0ea75
 
 
7f9c0e7
 
 
 
 
7e0ea75
7f9c0e7
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
import stripe
import globales

print("Haciendo pago en Oxxo...")

stripe.api_key = globales.llave

# Despu茅s de crear un Checkout Session
#session = stripe.checkout.Session.create(**session_params)

# Si necesitas recuperar el PaymentIntent asociado a la sesi贸n
payment_intent = stripe.PaymentIntent.retrieve('pi_3RupzSROVpWRmEfB1wEZghFL')
print("payment_intent obtenido...")

# Comprobar si hay alguna acci贸n necesaria
if hasattr(payment_intent, 'next_action') and payment_intent.next_action:
    # Aqu铆 hay una acci贸n pendiente que requiere atenci贸n
    action_type = payment_intent.next_action.type
    
    if action_type == 'oxxo_display_details':
        # Para pagos OXXO, obt茅n los detalles del voucher
        voucher_url = payment_intent.next_action.oxxo_display_details.hosted_voucher_url
        voucher_number = payment_intent.next_action.oxxo_display_details.number
        # Guardar o mostrar esta informaci贸n al cliente
        print(f"OXXO Voucher URL: {voucher_url}")
        print(f"OXXO Number: {voucher_number}")
    
    elif action_type == 'redirect_to_url':
        # Para 3D Secure u otros m茅todos que requieren redirecci贸n
        redirect_url = payment_intent.next_action.redirect_to_url.url
        # Redirigir al cliente a esta URL
        print(f"Redirect URL: {redirect_url}")
    
    # Otros tipos de acciones...