#franmondey - connect
1 messages · Page 1 of 1 (latest)
account = stripe.Account.create(
country="ES",
api_key=settings.STRIPE_SECRET_KEY,
type="custom",
capabilities={
"card_payments": {"requested": True},
"transfers": {"requested": True},
},
account_token=account_token
)
It's using the python sdk
settings.STRIPE_SECRET_KEY has the live api value I have in my account
I think you should set the API key like this:
import stripe
stripe.api_key = "sk_test_xxx"
As mentioned here: https://stripe.com/docs/api/accounts/create?lang=python
Also did that and doesn’t work
Same error
That’s why I tried adding it inside the request
I believe it might be a problem with account setup in stripe dashboard, as test keys work correctly. Only live doesn’t work
Can you triple check that the API key is the correct one? It should look like this sk_xxx.
Yes it’s sk_live format
I’m printing it before applying it to the request or as a global. I’m seeing in the error response from stripe to and it’s the correct one
Should there be a certain match with the publishable key? Or they just have to both be in the live environment?
When you switch to live mode, both publishable key and secret keys need to be updated to match.
Yes both are in live mode, but will check that again
Also will try to run it through curl to remove the possibility of error in library
Curl command works without errors
curl https://api.stripe.com/v1/accounts \
-u sk_xxxxx: \
-d type=custom \
-d country=ES \
-d account_token="xxxxxx" \
-d "capabilities[card_payments][requested]"=true \
-d "capabilities[transfers][requested]"=true
Using the same key used in the .envs declared or printed from the settings method
That's odd. Can you share the full code in python you are using and the exact error message? There must be something wrong there.
Ok was able to resolve it using the curl command inside python. Not sure why but it now works