Stripe Plugin: v6.0.7
v6.0.7 of Stripe introduces an improvement in Stripe's plugin's architecture and webhooks.
This version of Stripe requires at least v1.20 of @medusajs/medusa
. Refer to its update guide here.
Overview
There are two important changes that have been introduced to the Stripe plugin, one of which is breaking.
Architectural Improvement
The endpoints and subscribers in the plugin have been migrated to use our new API Routes and Subscribers. This significantly lowers the code footprint of the package and makes it easier to maintain.
Breaking Change: Webhooks and the Event Bus
The webhook event management has changed significantly; previously, it used in-band processing of the webhook events. Following this update, the Event Bus Service is used to process the event in a background job instead.
There were several motivations for this change:
- It's deemed best practice to respond with a 200 immediately upon receiving a webhook request.
- It allows for the retry mechanism to kick-in in case the processing fails.
- It provides more control of how the event is processed.
One example of the latter: starting from this release, you can now set a delay on processing events to avoid conflicts stemming from race conditions between the webhook and client requests. By default, the delay is five seconds.
Learn more about the new webhook options in the stripe plugin's guide
Required Actions
Since webhooks now rely on the Event Bus Service, make sure to install and setup an Event Bus module on your backend, if you haven't already. For production, please use the Redis Event Bus Module.
How to Update
:::warning [Important]
Make sure you're using at least v1.20 of @medusajs/medusa
. Refer to its update guide here.
:::
Run the following command in the root directory of your Medusa backend: