checkout/checkout-sdk-python

Your API Key is invalid

Closed this issue · 1 comments

When playing around with the sdk I'm getting AuthenticationError('Your API key is invalid.').

I got the secret key from the checkout.com sandbox page

And I can't seem to find the root cause of this.

Please send help

Ok I figured out why. I was doing

self.api = sdk.get_api(
    secret_key=settings.CO_SECRETKEY,
    sandbox=settings.CO_SANDBOX
)

When all along I should've been following the docs and follow this pattern

os.environ['CKO_SECRET_KEY'] = '<your secret key>'
os.environ['CKO_SANDBOX'] = 'True|true|1'               # else is False (Production)
os.environ['CKO_LOGGING'] = 'debug|DEBUG|info|INFO'

# ...

import checkout_sdk as sdk

api = sdk.get_api()