N.Achyuth Reddy commited on
Commit
a8d92f2
·
verified ·
1 Parent(s): 8b9c94f

Create app.py

Browse files
Files changed (1) hide show
  1. app.py +38 -0
app.py ADDED
@@ -0,0 +1,38 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import streamlit as st
2
+ from coinbase_commerce.client import Client
3
+
4
+ # Initialize Coinbase Commerce client
5
+ client = Client(api_key='5awMPNgazssjgI25c57dJaT96nWTGtRtZVGbOOxgGOQ')
6
+
7
+ # Constants
8
+ MEMBERSHIP_PRICE_USD = 10.0
9
+
10
+ # Function to create a charge for membership
11
+ def create_membership_charge():
12
+ charge_data = {
13
+ 'name': 'Monthly Membership',
14
+ 'description': 'Access to premium features for one month',
15
+ 'local_price': {
16
+ 'amount': MEMBERSHIP_PRICE_USD,
17
+ 'currency': 'USD'
18
+ },
19
+ 'pricing_type': 'fixed_price'
20
+ }
21
+ charge = client.charge.create(**charge_data)
22
+ return charge
23
+
24
+ # Streamlit UI
25
+ st.title("Membership Subscription")
26
+ st.write("Subscribe to our monthly membership for $10.")
27
+
28
+ if st.button("Subscribe with Bitcoin"):
29
+ charge = create_membership_charge()
30
+ bitcoin_address = charge['addresses']['bitcoin']
31
+ st.write("Please send Bitcoin to the following address:", bitcoin_address)
32
+ st.write("Your membership will be activated once the payment is confirmed.")
33
+
34
+ if st.button("Subscribe with Litecoin"):
35
+ charge = create_membership_charge()
36
+ litecoin_address = charge['addresses']['litecoin']
37
+ st.write("Please send Litecoin to the following address:", litecoin_address)
38
+ st.write("Your membership will be activated once the payment is confirmed.")