Stripe - what are all these different keys?

Viewed 494

What are all these keys and how are these used?

Dashboard:

The first 3 are visible in Dashboard.

Where are all these keys used?


What I've found out through trial and error: (I don't know how this would look like in production)

Decoding the event while CLI is running:


Webhook.constructEvent(rawRequestBody, signature, WEBHOOK_SIGNING_SECRET)

Setting API key globally

Stripe.apiKey = SECRET_KEY

My question are:

  • since there is no Stripe CLI running in prod, is the webhook_signing_secret the same as the secret_key? (event is not forwarded through the CLI)
  • why can't the Stripe CLI create an event with the signing secret encoded? it has already the publishable_key and secret_keys configured, why does it need a new one?
  • where is the restricted_key used?
1 Answers

You can read more about publishable, secret, and restricted API keys in Stripe's documentation on API keys.

since there is no Stripe CLI running in prod, is the webhook_signing_secret the same as the secret_key? (event is not forwarded through the CLI)

No, they are completely different and used for different things.

why can't the Stripe CLI create an event with the signing secret encoded? it has already the publishable_key and secret_keys configured, why does it need a new one?

Including the webhook signing secret in the event would defeat the purpose, prevent the security measure from working, and not be representative of how things work in production.

Related