#callmarl-error

1 messages · Page 1 of 1 (latest)

novel citrus
#

heya @tall bolt, which line of the code snippet specifically is throwing that error?

tall bolt
#

the request stripe.Token.create()

#
  File "/home/callmarl/dev/nopow_link/website/application/core/tests/__init__.py", line 181, in _create
    "cvc"           : "123"
  File "/home/callmarl/env/nopow_link/website/application/lib/python3.7/site-packages/stripe/api_resources/abstract/createable_api_resource.py", line 22, in create
    response, api_key = requestor.request("post", url, params, headers)
  File "/home/callmarl/env/nopow_link/website/application/lib/python3.7/site-packages/stripe/api_requestor.py", line 122, in request
    resp = self.interpret_response(rbody, rcode, rheaders)
  File "/home/callmarl/env/nopow_link/website/application/lib/python3.7/site-packages/stripe/api_requestor.py", line 399, in interpret_response
    self.handle_error_response(rbody, rcode, resp.data, rheaders)
  File "/home/callmarl/env/nopow_link/website/application/lib/python3.7/site-packages/stripe/api_requestor.py", line 159, in handle_error_response
    raise err
stripe.error.AuthenticationError: Invalid API Key provided: {'number************************************************************23'}
novel citrus
#

alright, are you sure you're initializing Stripe with the correct API key? cause looking at the error message - it's saying that your API key starts with number. A api test key would look like sk_test_...

tall bolt
#

Yes 100% sur. I use the little Stripe class when testing manually no error occur. I will show you.

#
I'am printing the key just before the error
sk_test_********
E
======================================================================
ERROR: test_simple_request (core.tests.d_as_setuped.test_links.LinksResponse)
stripe.error.AuthenticationError: Invalid API Key provided: {'number************************************************************23'}

----------------------------------------------------------------------
Ran 1 test in 5.158s
vast sigil
#

Hi! I'm taking over this thread.
I think you forgot something in your code:

stripe.Token.create(
card={ # <-- need to set card here
"number": "4242424242424242",
"exp_month": 1,
"exp_year": 2023,
"cvc": "314",
},
)

tall bolt
#

😮

#

Eagle eyes good job 🤓