Choose the correct key
You normally need one secret key for your backend and one publishable key for your frontend in each environment.
Create a key
Select the environment
Keep Dashboard in Test mode while developing. Switch to live mode only when you are preparing the production integration.
Open API keys
Select API keys in the Dashboard sidebar and choose Create API key.
Choose the type and label
Choose Secret or Publishable. Use a label that identifies the application and environment, such as
Storefront backend or Checkout frontend.Copy the key immediately
The complete key is shown once. Store secret keys in your server’s secret manager. Put publishable keys in browser-safe configuration.
Creating a key does not enable a payment method. Configure Card or Idram separately under Payment methods.
Keep environments aligned
The following resources must all use the same environment:- The secret key that creates the Payment Intent
- The Payment Intent and its client secret
- The publishable key passed to Checkout
- The enabled payment-method connection
- The webhook endpoint that receives the final event
Keep credentials safe
- Never commit any key to source control.
- Never send a secret key to the browser, mobile application, analytics, or logs.
- Do not put keys or client secrets in URLs.
- Give each application its own labelled key so you can revoke it independently.
- Revoke a key after replacing it in every environment that uses it.