- Get Started
- Product
- Resources
- Tools & SDKs
- Framework
- Reference
- Get Started
- Product
- Resources
- Tools & SDKs
- Framework
- Reference
Stripe Module Provider
In this document, you’ll learn about the Stripe Module Provider and how to configure it in the Payment Module.
Register the Stripe Module Provider#
The Stripe Module Provider is installed by default in your application. To use it, add it to the array of providers passed to the Payment Module in medusa-config.ts
:
1import { Modules } from "@medusajs/framework/utils"2 3// ...4 5module.exports = defineConfig({6 // ...7 modules: [8 {9 resolve: "@medusajs/medusa/payment",10 options: {11 providers: [12 {13 resolve: "@medusajs/medusa/payment-stripe",14 id: "stripe",15 options: {16 apiKey: process.env.STRIPE_API_KEY,17 },18 },19 ],20 },21 },22 ],23})
Environment Variables#
Make sure to add the necessary environment variables for the above options in .env
:
Module Options#
Option | Description | Required | Default |
---|---|---|---|
| A string indicating the Stripe Secret API key. | Yes | - |
| A string indicating the Stripe webhook secret. This is only useful for deployed Medusa applications. | Yes | - |
| Whether to automatically capture payment after authorization. | No |
|
| A boolean value indicating whether to enable Stripe's automatic payment methods. This is useful if you integrate services like Apple pay or Google pay. | No |
|
| A string used as the default description of a payment if none is available in cart.context.payment_description. | No | - |
Setup Stripe Webhooks#
For production applications, you must set up webhooks in Stripe that inform Medusa of changes and updates to payments. Refer to Stripe's documentation on how to setup webhooks.
Webhook URL#
Medusa has a {server_url}/hooks/payment/{provider_id}
API route that you can use to register webhooks in Stripe, where:
{server_url}
is the URL to your deployed Medusa application in server mode.{provider_id}
is the ID of the provider, such asstripe_stripe
for basic payments.
The Stripe Module Provider supports the following payment types, and the webhook endpoint URL is different for each:
Stripe Payment Type | Webhook Endpoint URL |
---|---|
Basic Stripe Payment |
|
Bancontact Payments |
|
BLIK Payments |
|
giropay Payments |
|
iDEAL Payments |
|
Przelewy24 Payments |
|
PromptPay Payments |
|
Webhook Events#
When you set up the webhook in Stripe, choose the following events to listen to:
payment_intent.amount_capturable_updated
payment_intent.succeeded
payment_intent.payment_failed
Useful Guides#
- Storefront guide: Add Stripe payment method during checkout.
- Integrate in Next.js Starter.
- Customize Stripe Integration in Next.js Starter.