Spaces:
Running
Running
Update src/streamlit_app.py
Browse files- src/streamlit_app.py +75 -0
src/streamlit_app.py
CHANGED
|
@@ -28,6 +28,81 @@ from streamlit_extras.stylable_container import stylable_container
|
|
| 28 |
|
| 29 |
|
| 30 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 31 |
|
| 32 |
|
| 33 |
|
|
|
|
| 28 |
|
| 29 |
|
| 30 |
|
| 31 |
+
# --- Payment Variables ---
|
| 32 |
+
# !!! CRITICAL 1: Replace this placeholder with your actual PayPal email or Merchant ID. !!!
|
| 33 |
+
PAYPAL_BUSINESS_EMAIL = "maria.tsilimos@proton.me"
|
| 34 |
+
CURRENCY_CODE = "USD"
|
| 35 |
+
# !!! CRITICAL 2: URL to redirect the user to after they successfully complete payment on PayPal.
|
| 36 |
+
SUCCESS_URL = "https://www.yourdomain.com/payment-thank-you"
|
| 37 |
+
|
| 38 |
+
# --- Fixed Price Configuration (Only one upgrade option) ---
|
| 39 |
+
FIXED_AMOUNT = 25.00
|
| 40 |
+
FIXED_ITEM_NAME = "Premium Service Upgrade"
|
| 41 |
+
ITEM_NAME = FIXED_ITEM_NAME
|
| 42 |
+
AMOUNT = FIXED_AMOUNT
|
| 43 |
+
|
| 44 |
+
# Generate the payment link with success redirection
|
| 45 |
+
PAYMENT_LINK = (
|
| 46 |
+
f"https://www.paypal.com/cgi-bin/webscr?"
|
| 47 |
+
f"cmd=_xclick&"
|
| 48 |
+
f"business={PAYPAL_BUSINESS_EMAIL}&"
|
| 49 |
+
f"item_name={ITEM_NAME}&"
|
| 50 |
+
f"amount={AMOUNT:.2f}&"
|
| 51 |
+
f"currency_code={CURRENCY_CODE}&"
|
| 52 |
+
f"return={SUCCESS_URL}"
|
| 53 |
+
)
|
| 54 |
+
|
| 55 |
+
# HTML for a clean, functional PayPal Button that only says "Upgrade"
|
| 56 |
+
paypal_html = f"""
|
| 57 |
+
<div style="margin-top: 0px; text-align: right;">
|
| 58 |
+
<a href="{PAYMENT_LINK}" target="_blank" style="
|
| 59 |
+
display: inline-block;
|
| 60 |
+
padding: 8px 16px;
|
| 61 |
+
font-size: 14px;
|
| 62 |
+
font-weight: bold;
|
| 63 |
+
color: white !important;
|
| 64 |
+
background-color: #0070BA;
|
| 65 |
+
border-radius: 5px;
|
| 66 |
+
text-align: center;
|
| 67 |
+
text-decoration: none;
|
| 68 |
+
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
|
| 69 |
+
transition: background-color 0.1s;
|
| 70 |
+
" onmouseover="this.style.backgroundColor='#008CDB'" onmouseout="this.style.backgroundColor='#0070BA'">
|
| 71 |
+
Upgrade
|
| 72 |
+
</a>
|
| 73 |
+
</div>
|
| 74 |
+
"""
|
| 75 |
+
|
| 76 |
+
# --- Layout: Place content and the button on the same top row ---
|
| 77 |
+
# col1: for the main content ("Hello")
|
| 78 |
+
# col_spacer: to push the button to the far right
|
| 79 |
+
# col3: for the "Upgrade" button
|
| 80 |
+
|
| 81 |
+
col1, col_spacer, col3 = st.columns([1, 5, 1])
|
| 82 |
+
|
| 83 |
+
# --- Content ---
|
| 84 |
+
with col1:
|
| 85 |
+
st.write("Hello")
|
| 86 |
+
|
| 87 |
+
# --- Button (Top Right) ---
|
| 88 |
+
with col3:
|
| 89 |
+
st.markdown(paypal_html, unsafe_allow_html=True)
|
| 90 |
+
|
| 91 |
+
# Note: The original verbose payment explanation sections have been removed.
|
| 92 |
+
|
| 93 |
+
|
| 94 |
+
|
| 95 |
+
|
| 96 |
+
|
| 97 |
+
|
| 98 |
+
|
| 99 |
+
|
| 100 |
+
|
| 101 |
+
|
| 102 |
+
|
| 103 |
+
|
| 104 |
+
|
| 105 |
+
|
| 106 |
|
| 107 |
|
| 108 |
|