gocardless / gocardless-pro-python

GoCardless Pro Python Client
MIT License
37 stars 26 forks source link

Invalid API usage error #30

Closed koopmac closed 5 years ago

koopmac commented 5 years ago

When I test my gocardless integration using sandbox on my localhost, I have no issue processing the customer with the success redirect url: "http://localhost:8000/subscription/index". However when I use https it returns 'connection refused' with no error. And when I attempt to add the live key with the correct domain it returns "nginx 502 bad gateway" with the following stack trace:

Traceback (most recent call last):
  File "/usr/local/lib/python3.6/site-packages/flask/app.py", line 2292, in wsgi_app
    response = self.full_dispatch_request()
  File "/usr/local/lib/python3.6/site-packages/flask/app.py", line 1815, in full_dispatch_request
    rv = self.handle_user_exception(e)
  File "/usr/local/lib/python3.6/site-packages/flask/app.py", line 1718, in handle_user_exception
    reraise(exc_type, exc_value, tb)
  File "/usr/local/lib/python3.6/site-packages/flask/_compat.py", line 35, in reraise
    raise value
  File "/usr/local/lib/python3.6/site-packages/flask/app.py", line 1813, in full_dispatch_request
    rv = self.dispatch_request()
  File "/usr/local/lib/python3.6/site-packages/flask/app.py", line 1799, in dispatch_request
    return self.view_functions[rule.endpoint](**req.view_args)
  File "/usr/local/lib/python3.6/site-packages/flask_login.py", line 792, in decorated_view
    return func(*args, **kwargs)
  File "/custodian/custodian/blueprints/billing/views/billing.py", line 316, in cardless
    "success_redirect_url" : "https://custodian.fund/subscription/index",
  File "/usr/local/lib/python3.6/site-packages/gocardless_pro/services/redirect_flows_service.py", line 39, in create
    retry_failures=True)
  File "/usr/local/lib/python3.6/site-packages/gocardless_pro/services/base_service.py", line 29, in _perform_request
    return self._attempt_request(method, path, params, headers)
  File "/usr/local/lib/python3.6/site-packages/gocardless_pro/services/base_service.py", line 43, in _attempt_request
    return self._api_client.post(path, body=params, headers=headers)
  File "/usr/local/lib/python3.6/site-packages/gocardless_pro/api_client.py", line 70, in post
    self._handle_errors(response)
  File "/usr/local/lib/python3.6/site-packages/gocardless_pro/api_client.py", line 127, in _handle_errors
    raise exception_class(error)
gocardless_pro.errors.InvalidApiUsageError: The access token you've used is not a valid live API access token

Does anyone know why the process is working with a http address but not https? This doesn't seem to be an invalid API issue.

jasonlafferty commented 5 years ago

Hi @gaiadas could you contact api@gocardless.com, as this doesn't seem to be an issue with the client library, our support team could assist you.

koopmac commented 5 years ago

Thanks Jason