Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -1,7 +1,8 @@
|
|
| 1 |
-
from flask import Flask, request
|
| 2 |
|
| 3 |
app = Flask(__name__)
|
| 4 |
|
|
|
|
| 5 |
@app.route("/payermax", methods=["POST", "GET"])
|
| 6 |
def payermax_notify():
|
| 7 |
try:
|
|
@@ -10,8 +11,30 @@ def payermax_notify():
|
|
| 10 |
print("🧾 Data:", data)
|
| 11 |
return "success", 200
|
| 12 |
except Exception as e:
|
| 13 |
-
print("🔥 Error:", str(e))
|
| 14 |
return "success", 200
|
| 15 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 16 |
if __name__ == "__main__":
|
| 17 |
app.run(host="0.0.0.0", port=7860)
|
|
|
|
| 1 |
+
from flask import Flask, request, jsonify
|
| 2 |
|
| 3 |
app = Flask(__name__)
|
| 4 |
|
| 5 |
+
# ✅ Route 1: PayerMax Callback (used in PayerMax Dashboard)
|
| 6 |
@app.route("/payermax", methods=["POST", "GET"])
|
| 7 |
def payermax_notify():
|
| 8 |
try:
|
|
|
|
| 11 |
print("🧾 Data:", data)
|
| 12 |
return "success", 200
|
| 13 |
except Exception as e:
|
| 14 |
+
print("🔥 Error in PayerMax callback:", str(e))
|
| 15 |
return "success", 200
|
| 16 |
|
| 17 |
+
|
| 18 |
+
# ✅ Route 2: Test Endpoint (you’ll call this from FlutterFlow)
|
| 19 |
+
@app.route("/test", methods=["POST"])
|
| 20 |
+
def test_endpoint():
|
| 21 |
+
try:
|
| 22 |
+
data = request.get_json(force=True, silent=True)
|
| 23 |
+
print("🧪 FlutterFlow test data:", data)
|
| 24 |
+
|
| 25 |
+
# Send back a response to show it works
|
| 26 |
+
return jsonify({
|
| 27 |
+
"status": "ok",
|
| 28 |
+
"message": "Received test data successfully!",
|
| 29 |
+
"echo": data
|
| 30 |
+
}), 200
|
| 31 |
+
except Exception as e:
|
| 32 |
+
print("🔥 Error in test endpoint:", str(e))
|
| 33 |
+
return jsonify({
|
| 34 |
+
"status": "error",
|
| 35 |
+
"message": str(e)
|
| 36 |
+
}), 500
|
| 37 |
+
|
| 38 |
+
|
| 39 |
if __name__ == "__main__":
|
| 40 |
app.run(host="0.0.0.0", port=7860)
|