Spaces:
Sleeping
Sleeping
| 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... |