Strapi 5 Plugin for Stripe
A Strapi 5 plugin to manage Stripe products and subscriptions directly from the admin panel, and provide a simple front-end checkout integration via a ready-to-use JavaScript snippet.
💳 Strapi 5 Plugin for Stripe
A Strapi 5 plugin to manage Stripe products and subscriptions directly from the admin panel, and provide a simple front-end checkout integration via a ready-to-use JavaScript snippet.
📚 Table of Contents
- 🚀 Installation
- 💡 Environment Variables (.env)
- 🪝 Webhooks (Signature Verification)
- ⚙️ Configuration
- 📦 Managing Products
- 🧑💻 Embed Payment Button Code
- 📝 License
🚀 Installation
- Copy the plugin into your Strapi project:
npm i strapi5-plugin-for-stripeor
yarn add strapi5-plugin-for-stripe- Restart Strapi:
yarn develop💡 Environment Variables (.env)
To use the Strapi Stripe plugin, you need to configure some environment variables in your Strapi project .env file. These variables allow the plugin to connect to your Stripe account securely.
Required Variables
| Variable | Description |
|---|---|
STRAPI_ADMIN_TEST_STRIPE_SECRET_KEY | Your Stripe Test Secret Key. Used when the plugin is in test mode. |
STRAPI_ADMIN_LIVE_STRIPE_SECRET_KEY | Your Stripe Live Secret Key. Used when the plugin is in live mode. |
STRAPI_ADMIN_STRIPE_WEBHOOK_SECRET_KEY | Your Stripe Webhook Secret. Needed if you are using Stripe webhooks to handle events. |
Example .env file
STRAPI_ADMIN_TEST_STRIPE_SECRET_KEY=sk_test_XXXXXXXXXXXXXXXXXXXXXXXX
STRAPI_ADMIN_LIVE_STRIPE_SECRET_KEY=sk_live_XXXXXXXXXXXXXXXXXXXXXXXX
STRAPI_ADMIN_STRIPE_WEBHOOK_SECRET_KEY=whsec_XXXXXXXXXXXXXXXXXXXXXXXX🪝 Webhooks (Signature Verification)
This plugin can receive Stripe webhook events, verify the Stripe signature, and forward the authenticated event payload to your external API (your business logic stays outside the plugin).
✅ The plugin does not process Stripe events internally.
It only authenticates the event (signature check) and then forwards it.
🧱 1) Enable raw body support in Strapi
Stripe signature verification requires the raw request body.
If Strapi parses the body first, verification will fail.
Edit your Strapi project middleware config:
config/middlewares.js
{
name: "strapi::body",
config: {
includeUnparsed: true,
},
},Then restart Strapi.
❌ Without this, Stripe verification will fail (invalid signature).
🔗 2) Stripe Webhook Endpoint URL
When you create the webhook in Stripe, Stripe needs an Endpoint URL (a public URL that Stripe can call).
In production, it should be your Strapi webhook route, for example: https://your-backend.com/api/strapi5-plugin-for-stripe/webhook
In local development, Stripe cannot call localhost directly. Use Stripe CLI instead (see below).
🔐 3) Create a Webhook endpoint in Stripe (to get the webhook secret)
- Open the Stripe Dashboard (Test or Live mode depending on your environment)
- Go to Developers → Webhooks
- Click Add endpoint
Select the events you want to receive (minimum recommended):
- checkout.session.completed
Depending on your use-case (subscriptions), you may also want:
- invoice.paid
- customer.subscription.deleted
- customer.subscription.created
- customer.subscription.updated
Enter your Endpoint URL
- Click Add endpoint
- Open the created endpoint → find Signing secret
- Click Reveal and copy the value (starting with
whsec_...)
You can now paste this value to your .env file
🧪 4) Local development (no public URL)
Stripe can’t reach localhost from the internet. Use the Stripe CLI to forward events to your local Strapi server:
stripe login
stripe listen --forward-to localhost:1337/api/strapi5-plugin-for-stripe/webhookThe CLI will display a temporary signing secret: Your webhook signing secret is whsec_...
Use that value in your .env during local development: STRAPI_ADMIN_STRIPE_WEBHOOK_SECRET_KEY=whsec_FROM_STRIPE_CLI
⚠️ The Stripe CLI signing secret changes every time you restart stripe listen.
⚙️ Configuration
Go to Admin Panel → Plugins → Stripe Settings and configure:
- Environment: test or live
- Currency: EUR, USD, GBP or CAD
- Webhook forward URL: Securly forward webhook events to a given URL
- Success URL: Redirect after successful payment
- Cancel URL: Redirect if payment is canceled
Save the settings once configured.
If you want to configure the allowed payment methods, you can do it directly in the Stripe Dashboard, by going to Settings → Payments → Payment methods.
📦 Managing Products
The plugin allows you to manage Stripe products directly from the admin UI.
Supported product types
- ✅ One-time payments
- 🔁 Subscriptions
Available fields
- Name
- Price (entered in main currency unit)
- Payment Type
- Interval (subscriptions only)
- Trial period (subscriptions only / optional)
Important Stripe behavior
Stripe prices are immutable. If you change the price or subscription interval, the plugin automatically:
- Creates a new price
- Deactivates the old one
This is handled transparently.
🧑💻 Embed Payment Button Code
After creating a product in the Stripe plugin, click on the Embed Code icon next to the product.
A modal will open with a ready-to-use integration snippet and clear instructions to help you add a payment button to your website.
To integrate the payment button:
- Copy the provided JavaScript snippet and paste it into your page.
- Add the payment button HTML to your product listing page.
- Configure the button using data-* attributes (price ID, customer email, metadata, etc.).
- Customize the button label (for example: Buy Now, Pay Now) and style it using your own CSS.
The product listing page is the page where your products are displayed and where customers can start the checkout process by clicking the payment button.
📝 License
This plugin is licensed under the MIT license. See the COPYING file for details.
©2026 Maxime Hamou
Install now
npm install strapi5-plugin-for-stripe
Create your own plugin
Check out the available plugin resources that will help you to develop your plugin or provider and get it listed on the marketplace.