* initialized next.js project * finished markdown sections * added operation schema component * change page metadata * eslint fixes * fixes related to deployment * added response schema * resolve max stack issue * support for different property types * added support for property types * added loading for components * added more loading * type fixes * added oneOf type * removed console * fix replace with push * refactored everything * use static content for description * fixes and improvements * added code examples section * fix path name * optimizations * fixed tag navigation * add support for admin and store references * general enhancements * optimizations and fixes * fixes and enhancements * added search bar * loading enhancements * added loading * added code blocks * added margin top * add empty response text * fixed oneOf parameters * added path and query parameters * general fixes * added base path env variable * small fix for arrays * enhancements * design enhancements * general enhancements * fix isRequired * added enum values * enhancements * general fixes * general fixes * changed oas generation script * additions to the introduction section * added copy button for code + other enhancements * fix response code block * fix metadata * formatted store introduction * move sidebar logic to Tags component * added test env variables * fix code block bug * added loading animation * added expand param + loading * enhance operation loading * made responsive + improvements * added loading provider * fixed loading * adjustments for small devices * added sidebar label for endpoints * added feedback component * fixed analytics * general fixes * listen to scroll for other headings * added sample env file * update api ref files + support new fields * fix for external docs link * added new sections * fix last item in sidebar not showing * move docs content to www/docs * change redirect url * revert change * resolve build errors * configure rewrites * changed to environment variable url * revert changing environment variable name * add environment variable for API path * fix links * fix tailwind settings * remove vercel file * reconfigured api route * move api page under api * fix page metadata * fix external link in navigation bar * update api spec * updated api specs * fixed google lint error * add max-height on request samples * add padding before loading * fix for one of name * fix undefined types * general fixes * remove response schema example * redesigned navigation bar * redesigned sidebar * fixed up paddings * added feedback component + report issue * fixed up typography, padding, and general styling * redesigned code blocks * optimization * added error timeout * fixes * added indexing with algolia + fixes * fix errors with algolia script * redesign operation sections * fix heading scroll * design fixes * fix padding * fix padding + scroll issues * fix scroll issues * improve scroll performance * fixes for safari * optimization and fixes * fixes to docs + details animation * padding fixes for code block * added tab animation * fixed incorrect link * added selection styling * fix lint errors * redesigned details component * added detailed feedback form * api reference fixes * fix tabs * upgrade + fixes * updated documentation links * optimizations to sidebar items * fix spacing in sidebar item * optimizations and fixes * fix endpoint path styling * remove margin * final fixes * change margin on small devices * generated OAS * fixes for mobile * added feedback modal * optimize dark mode button * fixed color mode useeffect * minimize dom size * use new style system * radius and spacing design system * design fixes * fix eslint errors * added meta files * change cron schedule * fix docusaurus configurations * added operating system to feedback data * change content directory name * fixes to contribution guidelines * revert renaming content * added api-reference to documentation workflow * fixes for search * added dark mode + fixes * oas fixes * handle bugs * added code examples for clients * changed tooltip text * change authentication to card * change page title based on selected section * redesigned mobile navbar * fix icon colors * fix key colors * fix medusa-js installation command * change external regex in algolia * change changeset * fix padding on mobile * fix hydration error * update depedencies
39 KiB
description
| description |
|---|
| Learn about the available events and their data payloads in Medusa. Events can be used to perform an action when the events are triggered. |
Events Reference
This document details all events in Medusa, when they are triggered, and what data your handler method will receive when the event is triggered.
Prerequisites
It is assumed you’re already familiar with Subscribers in Medusa and how to listen to events. You can then use the name of events from this documentation in your subscriber to listen to events.
Legend
Events in this document are listed under the entity they’re associated with. They’re listed in a table of three columns:
- Event Name: The name you use to subscribe a handler for the event.
- Description: When this event is triggered.
- Event Data Payload: The data your handler receives as a parameter.
Batch Jobs Events
This section holds all events related to batch jobs.
| Event Name | Description | Event Data Payload |
|---|---|---|
|
|
Triggered when a batch job is created. |
Object of the following format:
|
|
|
Triggered when a batch job is updated. |
Object of the following format:
|
|
|
Triggered when a batch job is canceled. |
Object of the following format:
|
|
|
Triggered after the |
Object of the following format:
|
|
|
Triggered after the batch job is done pre-processing and the batch job is not in dry-run mode. |
Object of the following format:
|
|
|
Triggered when a batch job starts processing after it's confirmed. |
Object of the following format:
|
|
|
Triggered when a batch job is done processing and is completed. |
Object of the following format:
|
|
|
Triggered when an error occurs while running a batch job and the batch job fails. |
Object of the following format:
|
Cart Events
This section holds all events related to a cart.
| Event Name | Description | Event Data Payload |
|---|---|---|
|
|
Triggered when a cart is associated with a different email than it was already associated with, or if a customer logs in after adding items to their cart as a guest. | The cart ID passed as a string parameter. |
|
|
Triggered when a cart is created. |
Object of the following format:
|
|
|
Triggered when a cart and data associated with it (payment sessions, shipping methods, user details, etc…) are updated. |
An object with at least the ID of the cart, however, in most cases the entire cart model is available. You can refer to the Cart entity for an idea of what fields to expect. |
Claim Events
This section holds all events related to claims.
| Event Name | Description | Event Data Payload |
|---|---|---|
|
|
Triggered when a claim is created. |
Object of the following format: |
|
|
Triggered when a claim is updated. |
Object of the following format: |
|
|
Triggered when a claim is canceled. |
Object of the following format: |
|
|
Triggered when fulfillment is created for a claim. |
Object of the following format: |
|
|
Triggered when a claim fulfillment is set as “shipped”. |
Object of the following format: |
|
|
Triggered when a claim of type “refunded” has been refunded. |
Object of the following format: |
Claim Item Events
This section holds all events related to claim items.
| Event Name | Description | Event Data Payload |
|---|---|---|
|
|
Triggered when claim items are created and associated with a claim. This happens during the creation of claims. |
Object of the following format: |
|
|
Triggered when a claim item is updated. This happens when a claim is updated. |
Object of the following format: |
|
|
Triggered when a claim is canceled. |
Object of the following format: |
Currency Events
This section holds all events related to currencies.
| Event Name | Description | Event Data Payload |
|---|---|---|
|
|
Triggered when a currency is updated. |
Object of the following format: |
Customer Events
This section holds all events related to customers.
| Event Name | Description | Event Data Payload |
|---|---|---|
|
|
Triggered when a customer is created. |
The entire customer passed as an object. You can refer to the Customer entity for an idea of what fields to expect. |
|
|
Triggered when a customer is updated including their information or password, or when a customer account is created that is associated with an existing email (for example, if a customer placed an order with their email as a guest, then created an account with that email). |
The entire customer passed as an object. You can refer to the Customer entity for an idea of what fields to expect. |
|
|
Triggered when a customer requests to reset their password. |
Object of the following format: |
Draft Order Events
This section holds all events related to draft orders.
| Event Name | Description | Event Data Payload |
|---|---|---|
|
|
Triggered when a draft order is created. |
Object of the following format: |
|
|
Triggered when a draft order and data associated with it (email, billing address, discount, etc…) are updated. |
Object of the following format: |
Gift Card Events
This section holds all events related to gift cards.
| Event Name | Description | Event Data Payload |
|---|---|---|
|
|
Triggered when a gift card is created. |
Object of the following format: |
Inventory Item Events
This section holds all events related to inventory items.
| Event Name | Description | Event Data Payload |
|---|---|---|
|
|
Triggered when an inventory item is created. |
Object of the following format: |
|
|
Triggered when an inventory item is updated. |
Object of the following format: |
|
|
Triggered when an inventory item is deleted. |
Object of the following format: |
Inventory Level Events
This section holds all events related to inventory levels.
| Event Name | Description | Event Data Payload |
|---|---|---|
|
|
Triggered when an inventory level is created. |
Object of the following format: |
|
|
Triggered when an inventory level is updated. |
Object of the following format: |
|
|
Triggered when an inventory level is deleted, which can be done either directly using its ID or based on the ID of a location. The returned ID depends on how the inventory level was deleted. |
Object of the following format: |
Invite Events
This section holds all events related to invites.
| Event Name | Description | Event Data Payload |
|---|---|---|
|
|
Triggered when an invite is created for a user to join the admin team. |
Object of the following format: |
Note Events
This section holds all events related to notes.
| Event Name | Description | Event Data Payload |
|---|---|---|
|
|
Triggered when a note is created. |
Object of the following format: |
|
|
Triggered when a note is updated. |
Object of the following format: |
|
|
Triggered when a note is deleted. |
Object of the following format: |
App Authentication Events
This section holds all events related to app authentications.
:::note
Event names of app authentication are scoped specifically towards each application. When listening to these events, you must replace <APP> with the name of the application you’re targeting.
:::
| Event Name | Description | Event Data Payload |
|---|---|---|
|
|
Triggered when a token is generated for an application. |
The returned data from the method |
|
|
Triggered when the token of an application is refreshed. |
The returned data from the method |
Order Events
This section holds all events related to orders.
| Event Name | Description | Event Data Payload |
|---|---|---|
|
|
Triggered when a new order is placed. |
Object of the following format: |
|
|
Triggered when an order and data associated with it (shipping method, shipping address, etc…) are updated. |
Object of the following format: |
|
|
Triggered when an order is canceled. |
Object of the following format: |
|
|
Triggered when an order is completed. |
Object of the following format: |
|
|
Triggered when an order is claimed. |
Object of the following format: |
|
|
Triggered when a gift card in an order is created. |
Object of the following format: |
|
|
Triggered when the payment of an order is captured. |
Object of the following format: |
|
|
Triggered when capturing the payment of an order fails. |
Object of the following format: |
|
|
Triggered when fulfillment is created for an order. |
Object of the following format: |
|
|
Triggered when a shipment is created for fulfillment and the fulfillment is registered as “shipped”. |
Object of the following format: |
|
|
Triggered when fulfillment of an order is canceled. |
Object of the following format: |
|
|
Triggered when a return of an order is requested. |
Object of the following format: |
|
|
Triggered when the items of an order have been returned and the order has been registered as “returned”. |
Object of the following format: |
|
|
Triggered when the order is being registered as “returned” but there are additional actions required related to refunding the payment. |
Object of the following format: |
|
|
Triggered when the order’s payment is refunded. |
Object of the following format: |
|
|
Triggered when the refund of the order’s payment fails. |
Object of the following format: |
|
|
Triggered when a swap for an order is created. |
Object of the following format: |
Order Edit Events
This section holds all events related to order edits.
| Event Name | Description | Event Data Payload |
|---|---|---|
|
|
Triggered when a order edit is created. |
Object of the following format: |
|
|
Triggered when an order edit is updated. |
Object of the following format: |
|
|
Triggered when an order edit is canceled. |
Object of the following format: |
|
|
Triggered when an order edit is declined. |
Object of the following format: |
|
|
Triggered when an order edit is requested. |
Object of the following format: |
|
|
Triggered when an order edit is confirmed. |
Object of the following format: |
Order Edit Item Changes Events
This section holds all events related to order edit item changes.
| Event Name | Description | Event Data Payload |
|---|---|---|
|
|
Triggered when an order edit item change is created. |
|
|
|
Triggered when an order edit item change is deleted. |
|
Payment Events
This section holds all events related to payment.
| Event Name | Description | Event Data Payload |
|---|---|---|
|
|
Triggered when a payment is created. |
The entire payment passed as an object. You can refer to the Payment entity for an idea of what fields to expect. |
|
|
Triggered when a payment is updated. |
The entire payment passed as an object. You can refer to the Payment entity for an idea of what fields to expect. |
|
|
Triggered when a payment is captured. |
The entire payment passed as an object. You can refer to the Payment entity for an idea of what fields to expect. |
|
|
Triggered when the capturing of a payment fails. |
The entire payment passed as an object. You can refer to the Payment entity for an idea of what fields to expect. In addition, an error object is passed within the same object as the Payment Processor: |
|
|
Triggered when a refund of a payment is created. |
The entire refund passed as an object. You can refer to the Refund entity for an idea of what fields to expect. |
|
|
Triggered when a payment's refund fails. |
The entire payment passed as an object. You can refer to the Payment entity for an idea of what fields to expect. |
Payment Collection Events
This section holds all events related to payment collections.
| Event Name | Description | Event Data Payload |
|---|---|---|
|
|
Triggered when a payment collection is created. |
The entire payment collection passed as an object. You can refer to the Payment Collection entity for an idea of what fields to expect. |
|
|
Triggered when a payment collection is update. |
The entire payment collection passed as an object. You can refer to the Payment Collection entity for an idea of what fields to expect. |
|
|
Triggered when a payment collection is deleted. |
The entire payment collection passed as an object. You can refer to the Payment Collection entity for an idea of what fields to expect. |
|
|
Triggered when a payment collection is either marked authorized or its payment session is authorized. |
The entire payment collection passed as an object. You can refer to the Payment Collection entity for an idea of what fields to expect. |
Product Events
This section holds all events related to products.
| Event Name | Description | Event Data Payload |
|---|---|---|
|
|
Triggered when a product is created. |
Object of the following format: |
|
|
Triggered when a product and data associated with it (options, variant orders, etc…) is updated. |
The entire product passed as an object. You can refer to the Product entity for an idea of what fields to expect. In one case, when the |
|
|
Triggered when a product is deleted. |
Object of the following format: |
Product Category Events
This section holds all events related to product categories.
:::note
Product Category feature is currently in beta mode and guarded by a feature flag. You can learn how to enable it in the Product Categories documentation.
:::
| Event Name | Description | Event Data Payload |
|---|---|---|
|
|
Triggered when a product category is created. |
Object of the following format: |
|
|
Triggered when a product category is updated. |
Object of the following format: |
|
|
Triggered when a product category is deleted. |
Object of the following format: |
Product Variant Events
This section holds all events related to product variants.
| Event Name | Description | Event Data Payload |
|---|---|---|
|
|
Triggered when a product variant is created. |
Object of the following format: |
|
|
Triggered when a product variant is updated. |
Object of the following format: |
|
|
Triggered when a product variant is deleted. |
Object of the following format: |
Publishable API Key Events
This section holds all events related to publishable API keys.
| Event Name | Description | Event Data Payload |
|---|---|---|
|
|
Triggered when a publishable API key is created. |
Object of the following format: |
|
|
Triggered when a publishable API key is revoked. |
Object of the following format: |
Region Events
This section holds all events related to regions.
| Event Name | Description | Event Data Payload |
|---|---|---|
|
|
Triggered when a region is created. |
Object of the following format: |
|
|
Triggered when a region or data associated with it (countries, fulfillment providers, etc…) are updated. |
Object of the following format: |
|
|
Triggered when a region is deleted. |
Object of the following format: |
Reservation Item Events
This section holds all events related to reservation items.
| Event Name | Description | Event Data Payload |
|---|---|---|
|
|
Triggered when a reservation item is created. |
Object of the following format: |
|
|
Triggered when an reservation item is updated. |
Object of the following format: |
|
|
Triggered when a reservation item is deleted, which can be done either directly using its ID or based on the ID of a location or a line item. The returned ID depends on how the reservation item was deleted. |
Object of the following format: |
Sales Channel Events
This section holds all events related to sales channels.
| Event Name | Description | Event Data Payload |
|---|---|---|
|
|
Triggered when a sales channel is created. |
Object of the following format: |
|
|
Triggered when a sales channel is updated |
Object of the following format: |
|
|
Triggered when a sales channel is deleted. |
Object of the following format: |
Stock Location Events
This section holds all events related to stock locations.
| Event Name | Description | Event Data Payload |
|---|---|---|
|
|
Triggered when a stock location is created. |
Object of the following format: |
|
|
Triggered when an stock location is updated. |
Object of the following format: |
|
|
Triggered when a stock location is deleted. |
Object of the following format: |
Swap Events
This section holds all events related to swaps.
| Event Name | Description | Event Data Payload |
|---|---|---|
|
|
Triggered when a swap is created. |
Object of the following format: |
|
|
Triggered when a swap is registered as received. |
Object of the following format: |
|
|
Triggered when fulfillment is created for a swap. |
Object of the following format: |
|
|
Triggered when a shipment is created for a swap and the fulfillment associated with it is set as “shipped”. |
Object of the following format: |
|
|
Triggered when payment is completed for a swap which happens when the cart associated with the swap is registered as completed. |
Object of the following format: |
|
|
Triggered when the payment is captured for a swap. |
Object of the following format: |
|
|
Triggered when the capturing of the payment of a swap fails. |
Object of the following format: |
|
|
Triggered when a swap’s amount difference is processed and refunded. |
Object of the following format: |
|
|
Triggered when processing and refunding a swap’s amount difference fails. |
Object of the following format: |
Token Events
This section holds all events related to tokens.
| Event Name | Description | Event Data Payload |
|---|---|---|
|
|
Triggered when a customer requests to claim an order and a token is created. |
Object of the following format: |
User Events
This section holds all events related to users.
| Event Name | Description | Event Data Payload |
|---|---|---|
|
|
Triggered when a user is created. |
Object of the following format: |
|
|
Triggered when a user is updated. |
Object of the following format: |
|
|
Triggered when a user requests to reset their password. |
Object of the following format: |
|
|
Triggered when a user is deleted. |
Object of the following format: |