direct / src /streamlit_app.py
AIEcosystem's picture
Update src/streamlit_app.py
d5c5b03 verified
import streamlit as st
# Set a centered layout for a cleaner, minimal look
st.set_page_config(layout="centered")
# --- Start of User-Requested Content ---
st.write("Hello")
# --- End of User-Requested Content ---
# --- Payment Variables (MUST UPDATE) ---
# !!! CRITICAL 1: Replace this placeholder with your actual PayPal email or Merchant ID. !!!
PAYPAL_BUSINESS_EMAIL = "maria.tsilimos@proton.me"
CURRENCY_CODE = "USD"
# !!! CRITICAL 2: URL to redirect the user to after they successfully complete payment on PayPal.
SUCCESS_URL = "https://www.yourdomain.com/payment-thank-you"
# --- Fixed Price Configuration ---
FIXED_AMOUNT = 25.00
FIXED_ITEM_NAME = "Basic Service Payment"
ITEM_NAME = FIXED_ITEM_NAME
AMOUNT = FIXED_AMOUNT
# --- End of Variables ---
st.markdown("---")
st.subheader(f"Secure Payment for {FIXED_ITEM_NAME}")
st.write(f"Click below to pay the fixed amount of **${AMOUNT:.2f}**.")
# Generate the payment link with success redirection (key is '&return={SUCCESS_URL}')
PAYMENT_LINK = (
f"https://www.paypal.com/cgi-bin/webscr?"
f"cmd=_xclick&"
f"business={PAYPAL_BUSINESS_EMAIL}&"
f"item_name={ITEM_NAME}&"
f"amount={AMOUNT:.2f}&"
f"currency_code={CURRENCY_CODE}&"
f"return={SUCCESS_URL}"
)
# HTML for a clean, functional PayPal Button
paypal_html = f"""
<div style="margin-top: 20px;">
<a href="{PAYMENT_LINK}" target="_blank" style="
display: inline-block;
padding: 10px 20px;
font-size: 16px;
font-weight: bold;
color: white !important;
background-color: #0070BA;
border-radius: 5px;
text-align: center;
text-decoration: none;
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
transition: background-color 0.1s;
" onmouseover="this.style.backgroundColor='#008CDB'" onmouseout="this.style.backgroundColor='#0070BA'">
Pay Now (${AMOUNT:.2f})
</a>
</div>
"""
# Inject the HTML into the Streamlit app
st.markdown(paypal_html, unsafe_allow_html=True)
st.markdown("---")
st.info(
"The payment link is fully configured to redirect the user to the URL specified in the `SUCCESS_URL` variable after payment completion."
)