Set up Steel with Stripe Projects
Stripe Projects is a Stripe CLI workflow that provisions services from other providers and writes their credentials into your project. With Steel, one command creates a Steel project and an API key for it, and puts the key in your .env file as STEEL_API_KEY. Your code then uses Steel as usual, with the Steel SDK, the API or the Steel CLI.
You do not need a Steel account first. The command links your Stripe account to a Steel organization, and creates the organization when it does not exist. The project and the key belong to that organization, which you own.
Before you begin
- The Stripe CLI with the Projects plugin, and a Stripe Projects workspace in your app's directory. Install the plugin, then initialize the workspace:
stripe plugin install projects stripe projects init my-app - Node.js or Python, with the Steel SDK, to check the key at the end.
Set up the integration
Add Steel to your project
In your app's directory, add the steel/browser service:
stripe projects add steel/browserSteel creates a project and an API key that works only in that project. Stripe Projects writes the key into your environment file, .env by default:
STEEL_API_KEY=ste-...To list the variables that Stripe Projects wrote, with the values hidden, run stripe projects env.
Steel creates a new project for each Stripe project. You cannot link a Steel project that already exists.
Check the key
The Steel SDK reads STEEL_API_KEY from the environment. This program creates a session with the key, prints its ID and releases it.
import Steel from "steel-sdk";
const client = new Steel();
const session = await client.sessions.create();
try {
console.log("Session:", session.id);
} finally {
await client.sessions.release(session.id);
}from steel import Steel
client = Steel()
session = client.sessions.create()
try:
print("Session:", session.id)
finally:
client.sessions.release(session.id)The SDK does not read the .env file by itself. Load the file into your shell, then run the program:
npm install steel-sdk
set -a; source .env; set +a
npx tsx check-key.mtspython3 -m venv .venv
source .venv/bin/activate
pip install steel-sdk
set -a; source .env; set +a
python check_key.pyThe program prints the session ID. A printed ID means that the key works.
Session: 9b5a9713-5d01-4065-a3d5-8c58faff330ePull the key on another machine
If a teammate added Steel, or you cloned the repository, pull the current credentials into your environment file:
stripe projects env --pullChange the plan
Steel is available through Stripe Projects on the Launch and Scale plans. A new organization starts on Launch. To change the plan from the Stripe CLI, run:
stripe projects upgrade steel/browserPricing has what each plan includes and costs, and Limits has each plan's limits.
Remove Steel from the project
To remove the Steel service from your Stripe project, run:
stripe projects remove steel/browserSteel revokes the API key and deletes the Steel project. Removing a Scale plan returns the organization to Launch. Revoking the key in the dashboard also removes the service from your Stripe project, but it keeps the Steel project.
The Stripe CLI does not delete the revoked key from .env. Delete it yourself, or run stripe projects env --pull to overwrite the file with the current credentials.
If you revoke the key in Steel instead, Steel asks Stripe Projects to remove the Steel service from your Stripe project.