N.Achyuth Reddy
Create app.py
a8d92f2 verified
raw
history blame
1.34 kB
import streamlit as st
from coinbase_commerce.client import Client
# Initialize Coinbase Commerce client
client = Client(api_key='5awMPNgazssjgI25c57dJaT96nWTGtRtZVGbOOxgGOQ')
# Constants
MEMBERSHIP_PRICE_USD = 10.0
# Function to create a charge for membership
def create_membership_charge():
charge_data = {
'name': 'Monthly Membership',
'description': 'Access to premium features for one month',
'local_price': {
'amount': MEMBERSHIP_PRICE_USD,
'currency': 'USD'
},
'pricing_type': 'fixed_price'
}
charge = client.charge.create(**charge_data)
return charge
# Streamlit UI
st.title("Membership Subscription")
st.write("Subscribe to our monthly membership for $10.")
if st.button("Subscribe with Bitcoin"):
charge = create_membership_charge()
bitcoin_address = charge['addresses']['bitcoin']
st.write("Please send Bitcoin to the following address:", bitcoin_address)
st.write("Your membership will be activated once the payment is confirmed.")
if st.button("Subscribe with Litecoin"):
charge = create_membership_charge()
litecoin_address = charge['addresses']['litecoin']
st.write("Please send Litecoin to the following address:", litecoin_address)
st.write("Your membership will be activated once the payment is confirmed.")