eagle0504 commited on
Commit
4a98305
·
verified ·
1 Parent(s): 7f982fb

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +21 -21
app.py CHANGED
@@ -53,32 +53,32 @@ def list_prices_for_product(product_id):
53
  return None
54
 
55
  # Example usage
56
- product_id = 'your-product-id' # Replace with your actual Product ID
57
  prices = list_prices_for_product(product_id)
58
 
59
  if prices:
60
  for price in prices.data:
61
  print(f"Price ID: {price.id}, Amount: {price.unit_amount}, Currency: {price.currency}")
62
 
63
- # Button to redirect to Stripe Checkout
64
- if st.button("Create Checkout Session"):
65
- session_id, checkout_url = create_checkout_session()
66
- if session_id and checkout_url:
67
- st.session_state.session_id = session_id
68
- st.write(f"Checkout URL: {checkout_url}")
69
- st.markdown(f"[Proceed to Checkout]({checkout_url})", unsafe_allow_html=True)
70
 
71
- # Input for session ID to check payment status
72
- if st.session_state.session_id:
73
- st.write(f"Your session ID: {st.session_state.session_id}")
74
- if st.button("Check Payment Status"):
75
- st.write("Checking payment status, please wait...")
76
- time.sleep(2) # Simulating delay for payment processing
77
 
78
- if check_payment_status(st.session_state.session_id):
79
- st.success("Payment successful!")
80
- st.write("Here's the paid content.")
81
- else:
82
- st.error("Payment not completed yet. Please try again.")
83
- else:
84
- st.info("Create a checkout session to get the session ID.")
 
53
  return None
54
 
55
  # Example usage
56
+ product_id = stripe_product_id # Replace with your actual Product ID
57
  prices = list_prices_for_product(product_id)
58
 
59
  if prices:
60
  for price in prices.data:
61
  print(f"Price ID: {price.id}, Amount: {price.unit_amount}, Currency: {price.currency}")
62
 
63
+ # # Button to redirect to Stripe Checkout
64
+ # if st.button("Create Checkout Session"):
65
+ # session_id, checkout_url = create_checkout_session()
66
+ # if session_id and checkout_url:
67
+ # st.session_state.session_id = session_id
68
+ # st.write(f"Checkout URL: {checkout_url}")
69
+ # st.markdown(f"[Proceed to Checkout]({checkout_url})", unsafe_allow_html=True)
70
 
71
+ # # Input for session ID to check payment status
72
+ # if st.session_state.session_id:
73
+ # st.write(f"Your session ID: {st.session_state.session_id}")
74
+ # if st.button("Check Payment Status"):
75
+ # st.write("Checking payment status, please wait...")
76
+ # time.sleep(2) # Simulating delay for payment processing
77
 
78
+ # if check_payment_status(st.session_state.session_id):
79
+ # st.success("Payment successful!")
80
+ # st.write("Here's the paid content.")
81
+ # else:
82
+ # st.error("Payment not completed yet. Please try again.")
83
+ # else:
84
+ # st.info("Create a checkout session to get the session ID.")