File size: 2,179 Bytes
c4f69ba
 
 
 
 
 
 
 
 
 
 
d5c5b03
c4f69ba
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
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."
)