Spaces:
Running
Running
Update main.py
Browse files
main.py
CHANGED
|
@@ -1371,6 +1371,25 @@ def log_call_usage(project_id):
|
|
| 1371 |
return jsonify({'error': 'A server error occurred while updating credits.'}), 500
|
| 1372 |
|
| 1373 |
#Stripe Payments
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1374 |
@app.route("/api/billing/create-checkout-session", methods=["POST"])
|
| 1375 |
def create_checkout_session():
|
| 1376 |
"""
|
|
|
|
| 1371 |
return jsonify({'error': 'A server error occurred while updating credits.'}), 500
|
| 1372 |
|
| 1373 |
#Stripe Payments
|
| 1374 |
+
@app.route("/api/billing/config", methods=["GET"])
|
| 1375 |
+
def get_stripe_config():
|
| 1376 |
+
"""
|
| 1377 |
+
Returns safe-to-expose Stripe configuration values for the frontend.
|
| 1378 |
+
(No secret keys — only publishable data)
|
| 1379 |
+
"""
|
| 1380 |
+
try:
|
| 1381 |
+
return jsonify({
|
| 1382 |
+
"publishableKey": os.environ.get("STRIPE_PUBLISHABLE_KEY"),
|
| 1383 |
+
"priceIds": {
|
| 1384 |
+
"fixer": os.environ.get("STRIPE_PRICE_FIXER"),
|
| 1385 |
+
"pro": os.environ.get("STRIPE_PRICE_PRO"),
|
| 1386 |
+
}
|
| 1387 |
+
}), 200
|
| 1388 |
+
except Exception as e:
|
| 1389 |
+
logger.error(f"[STRIPE] Failed to serve config: {e}")
|
| 1390 |
+
return jsonify({"error": "Server configuration error"}), 500
|
| 1391 |
+
|
| 1392 |
+
|
| 1393 |
@app.route("/api/billing/create-checkout-session", methods=["POST"])
|
| 1394 |
def create_checkout_session():
|
| 1395 |
"""
|