Spaces:
Paused
Paused
Update app.py
Browse files
app.py
CHANGED
|
@@ -31,8 +31,11 @@ def create_payment(req: PaymentRequest):
|
|
| 31 |
"Content-Type": "application/json"
|
| 32 |
}
|
| 33 |
r = requests.post("https://api.chargily.com/v1/payment-links", json=payload, headers=headers)
|
| 34 |
-
if r.
|
| 35 |
raise HTTPException(status_code=500, detail=r.text)
|
| 36 |
-
|
|
|
|
|
|
|
|
|
|
| 37 |
except Exception as e:
|
| 38 |
raise HTTPException(status_code=500, detail=str(e))
|
|
|
|
| 31 |
"Content-Type": "application/json"
|
| 32 |
}
|
| 33 |
r = requests.post("https://api.chargily.com/v1/payment-links", json=payload, headers=headers)
|
| 34 |
+
if not r.ok:
|
| 35 |
raise HTTPException(status_code=500, detail=r.text)
|
| 36 |
+
|
| 37 |
+
# Return only the payment_url
|
| 38 |
+
payment_link = r.json().get("payment_url")
|
| 39 |
+
return {"payment_url": payment_link}
|
| 40 |
except Exception as e:
|
| 41 |
raise HTTPException(status_code=500, detail=str(e))
|