tylerjrichards / st-paywall

A python package for creating subscription Streamlit apps
MIT License
235 stars 46 forks source link

St-paywall >>> PermissionError: Request req_RvqaWvQhVA7wxB: We're sorry, but we're unable to serve your request #70

Closed cho-amh-programmerExpert closed 1 month ago

cho-amh-programmerExpert commented 1 month ago

“PermissionError: Request req_RvqaWvQhVA7wxB: We’re sorry, but we’re unable to serve your request.” is the error that I get when using the st-paywall component. I have already set the permissions for the restricted stripe api key i used to: Subscriptions >>> Read Customers >>> Read

But I still get that error. Can somebody help me with that please?

tylerjrichards commented 1 month ago

hey there, is there a good reason why you're using a restricted stripe api key? Can you show me a screenshot of your permissions setup?

cho-amh-programmerExpert commented 1 month ago

I can show it, But even when using a standard key, I still have the same issue.

Note that Im in test mode.

tylerjrichards commented 1 month ago

Got it, it seems like you have a permissions issue on the Stripe side, and that much is really hard to debug from this package.

Can you try something like this in another python file?

stripe.api_key = "put your api key here"
customers = stripe.Customer.list(email=email)
try:
    customer = customers.data[0]
except IndexError:
    return False

subscriptions = stripe.Subscription.list(customer=customer["id"])
print(customers.data[0])
print(subscriptions[0])
cho-amh-programmerExpert commented 1 month ago

Yes, let me try. I will report you the result

cho-amh-programmerExpert commented 1 month ago

Here is the result: It relates to customers = stripe.Customer.list(email=email)

Traceback (most recent call last):
  File "C:\Users\amh\Desktop\test.py", line 16, in <module>
    s('a.faravardeh@gmail.com')
  File "C:\Users\amh\Desktop\test.py", line 6, in s
    customers = stripe.Customer.list(email=email)
  File "C:\Users\amh\AppData\Local\Programs\Python\Python310\lib\site-packages\stripe\_customer.py", line 1571, in list
    result = cls._static_request(
  File "C:\Users\amh\AppData\Local\Programs\Python\Python310\lib\site-packages\stripe\_api_resource.py", line 131, in _static_request
    return _APIRequestor._global_instance().request(
  File "C:\Users\amh\AppData\Local\Programs\Python\Python310\lib\site-packages\stripe\_api_requestor.py", line 176, in request
    resp = requestor._interpret_response(rbody, rcode, rheaders)
  File "C:\Users\amh\AppData\Local\Programs\Python\Python310\lib\site-packages\stripe\_api_requestor.py", line 566, in _interpret_response
    self.handle_error_response(rbody, rcode, resp.data, rheaders)
  File "C:\Users\amh\AppData\Local\Programs\Python\Python310\lib\site-packages\stripe\_api_requestor.py", line 242, in handle_error_response
    raise err
stripe._error.PermissionError: Request req_nOfvCk198Vnj8P: We're sorry, but we're unable to serve your request.
cho-amh-programmerExpert commented 1 month ago

So?

tylerjrichards commented 1 month ago

I'm not sure why this isn't working for you, it looks like this is not a st-paywall issue but an issue with your stripe setup

cho-amh-programmerExpert commented 1 month ago

Btw I forgot to say I'm using a proxy

tylerjrichards commented 1 month ago

what is a proxy? why are you using it?

cho-amh-programmerExpert commented 1 month ago

I meant internet proxy. (In windows: Control Panel>Internet Options>Connections). I set a socks proxy for security.

tylerjrichards commented 1 month ago

sounds good, I don't think this is a st-paywall issue, it just looks like you need to figure out your stripe account + api setup. I'm going to close this issue!

cho-amh-programmerExpert commented 1 month ago

Stripe doesn't support proxy. Can you add that support as an option into st-paywall?

tylerjrichards commented 1 month ago

I cannot change how stripe handles their api

cho-amh-programmerExpert commented 1 month ago

I meant that stripe accepts parameters for proxy.