Spaces:
Running
Running
Add multicurrency
Browse files- currencies.py +28 -0
- funciones.py +17 -4
currencies.py
ADDED
@@ -0,0 +1,28 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
session_params = {
|
2 |
+
'line_items': [{
|
3 |
+
'price': price_id,
|
4 |
+
'quantity': 1, #maneja cantidades cuando es subscription
|
5 |
+
}],
|
6 |
+
'mode': mode, #payment o subscription
|
7 |
+
'payment_method_types': ['card'],
|
8 |
+
'success_url': 'https://app.splashmix.ink/',
|
9 |
+
'cancel_url': 'https://app.splashmix.ink/',
|
10 |
+
'locale': 'auto',
|
11 |
+
# 'client_reference_id': 'HERC',
|
12 |
+
'metadata': {
|
13 |
+
'imagenes': unidades
|
14 |
+
}, # Inicializamos metadata para a帽adir el customer_id y firebase_user si existen
|
15 |
+
'payment_intent_data': {
|
16 |
+
# Habilita los m茅todos de pago autom谩ticos
|
17 |
+
'automatic_payment_methods': {
|
18 |
+
'enabled': True,
|
19 |
+
'allow_redirects': 'always',
|
20 |
+
},
|
21 |
+
# Configura la conversi贸n autom谩tica de moneda
|
22 |
+
'currency_conversion': {
|
23 |
+
'automatic': {
|
24 |
+
'enabled': True,
|
25 |
+
},
|
26 |
+
},
|
27 |
+
},
|
28 |
+
}
|
funciones.py
CHANGED
@@ -89,14 +89,27 @@ def create_checkout_session(price_id, customer_email=None, customer_id=None, fir
|
|
89 |
'quantity': 1, #maneja cantidades cuando es subscription
|
90 |
}],
|
91 |
'mode': mode, #payment o subscription
|
92 |
-
'payment_method_types': ['card'
|
93 |
'success_url': 'https://app.splashmix.ink/',
|
94 |
-
'cancel_url': 'https://app.splashmix.ink/',
|
95 |
'locale': 'auto',
|
96 |
-
'client_reference_id': 'HERC',
|
97 |
'metadata': {
|
98 |
'imagenes': unidades
|
99 |
-
} # Inicializamos metadata para a帽adir el customer_id y firebase_user si existen
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
100 |
}
|
101 |
|
102 |
# Asociar el cliente encontrado/creado a la sesi贸n
|
|
|
89 |
'quantity': 1, #maneja cantidades cuando es subscription
|
90 |
}],
|
91 |
'mode': mode, #payment o subscription
|
92 |
+
'payment_method_types': ['card'],
|
93 |
'success_url': 'https://app.splashmix.ink/',
|
94 |
+
'cancel_url': 'https://app.splashmix.ink/',
|
95 |
'locale': 'auto',
|
96 |
+
# 'client_reference_id': 'HERC',
|
97 |
'metadata': {
|
98 |
'imagenes': unidades
|
99 |
+
}, # Inicializamos metadata para a帽adir el customer_id y firebase_user si existen
|
100 |
+
'payment_intent_data': {
|
101 |
+
# Habilita los m茅todos de pago autom谩ticos
|
102 |
+
'automatic_payment_methods': {
|
103 |
+
'enabled': True,
|
104 |
+
'allow_redirects': 'always',
|
105 |
+
},
|
106 |
+
# Configura la conversi贸n autom谩tica de moneda
|
107 |
+
'currency_conversion': {
|
108 |
+
'automatic': {
|
109 |
+
'enabled': True,
|
110 |
+
},
|
111 |
+
},
|
112 |
+
},
|
113 |
}
|
114 |
|
115 |
# Asociar el cliente encontrado/creado a la sesi贸n
|