Skip to main content
The Seller module service reads and writes the module’s records directly, without a workflow. Use it for reads in subscribers, scheduled jobs, and custom steps. Its writes don’t emit events, run hooks, or roll back, so prefer the workflows for changes.

Resolve the service

Resolve the service from the Medusa container with the MercurModules.SELLER key from @mercurjs/types.
This lists the 20 newest open premium stores and the total count of matches.

Generated methods

The service extends Medusa’s MedusaService, which generates the same eight methods for every model. For Seller they are: Each model gets the same set under its own name:

Custom methods

The service overrides some generated methods and adds a few of its own.

createSellers and updateSellers

Both validate handle and throw INVALID_DATA when it isn’t URL safe. When handle is missing and name is present, both set the handle from the name.

upsertMembers

Matches members by email and creates the missing ones. For existing members, it fills first_name and last_name only when they’re empty. It returns the members in input order.

createMemberInvites

Throws INVALID_DATA if an email already belongs to the target store. For each invite, it signs a JWT with the module’s jwt_secret, stores it in token, and sets expires_at from invite_valid_duration.

validateMemberInviteToken

Verifies the token’s signature and returns its invite. Throws INVALID_DATA for a bad signature, and NOT_ALLOWED when the invite is accepted or expired.

getStatistics

Counts stores by status and returns { total, premium, by_status }, where by_status has a key for every SellerStatus value.

Order group reads

listOrderGroups, listAndCountOrderGroups, and retrieveOrderGroup go through a custom repository that computes seller_count and total. See the order group service.

Module options

The service reads these options from its module registration, typed by SellerModuleOptions: