A Directus extension that allows you to build flows and custom endpoints to handle Stripe Webhooks and make Stripe API calls. The best part is that it's fully integrated with Directus accountability and permissions. It's a small but mighty extension if you are looking to integrate Stripe!
Stripe.Directus.Extension.mp4
This is a bundle extension that contains a middleware hook that verifies the Stripe-Signature
header, and an operation node that injects the Stripe secret key into a flow so you can make API requests with the request node e.g. GET https://{{stripe_secret_key}}:@api.stripe.com/v1/customers/{{stripe_customer_id}}
.
Check out the example for more details.
Once you've installed the extension, to connect Stripe, you can either set the following environment variables:
STRIPE_SECRET_KEY
: Your Stripe secret key (e.g.sk_...
)STRIPE_WEBHOOK_PATH
: The path to your webhook, relative to your Directus base URL (e.g./flows/triggers/...
)STRIPE_WEBHOOK_SECRET
: Your webhook's secret (e.g.whsec_...
)
Or you can configure these variables on the Settings page in Directus:
NOTE: In order for the settings to appear and for the middleware hook to be installed, you must restart your Directus instance after installing the extension. This is because they rely on the app.before
and middleware.before
events which only occur when Directus starts.
Currently, this extension is not sandboxed so it won't appear in the Directus Marketplace by default. However, you can set MARKETPLACE_TRUST="all"
so the extension becomes visible.