Skip to main content

ISellerModuleService Reference

This section of the documentation provides a reference to the ISellerModuleService interface’s methods. This is the interface developers use to use the functionalities provided by the Seller Module.
You should only use the methods in this reference when implementing complex customizations. For common cases, check out available workflows instead.
The main service interface for the Seller Module.

Methods

Seller Methods

Member Methods

Member Invite Methods

Seller Onboarding Methods


createSellers

This section provides a reference to the createSellers method. This belongs to the Seller Module.

createSellers(data, sharedContext?): Promise<SellerDTO[]>

This method creates sellers.

Example

const sellers = await sellerModuleService.createSellers([
  {
    name: "Acme Store",
    handle: "acme-store",
    email: "[email protected]",
    description: "Quality products for everyone",
  },
])

Parameters

data
CreateSellerDTO[]
required
The sellers to be created.
sharedContext
Context
A context used to share resources, such as transaction manager, between the application and the module.

Returns

Promise
Promise<SellerDTO[]>
The created sellers.

createSellers(data, sharedContext?): Promise<SellerDTO>

This method creates a seller.

Example

const seller = await sellerModuleService.createSellers({
  name: "Acme Store",
  handle: "acme-store",
})

Parameters

data
CreateSellerDTO
required
The seller to be created.
sharedContext
Context
A context used to share resources, such as transaction manager, between the application and the module.

Returns

Promise
Promise<SellerDTO>
The created seller.

updateSellers

This section provides a reference to the updateSellers method. This belongs to the Seller Module.

updateSellers(id, data, sharedContext?): Promise<SellerDTO>

This method updates an existing seller.

Example

const seller = await sellerModuleService.updateSellers("sel_123", {
  name: "Updated Store Name",
  description: "New description",
  store_status: "ACTIVE",
})

Parameters

id
string
required
The ID of the seller.
data
UpdateSellerDTO
required
The attributes to update in the seller.
sharedContext
Context
A context used to share resources, such as transaction manager, between the application and the module.

Returns

Promise
Promise<SellerDTO>
The updated seller.

deleteSellers

This section provides a reference to the deleteSellers method. This belongs to the Seller Module.

deleteSellers(ids, sharedContext?): Promise<void>

This method deletes sellers by their IDs.

Example

await sellerModuleService.deleteSellers(["sel_123", "sel_321"])

Parameters

ids
string[]
required
The IDs of the sellers.
sharedContext
Context
A context used to share resources, such as transaction manager, between the application and the module.

Returns

Promise
Promise<void>
Resolves when the sellers are deleted successfully.

deleteSellers(id, sharedContext?): Promise<void>

This method deletes a seller by its ID.

Example

await sellerModuleService.deleteSellers("sel_123")

Parameters

id
string
required
The ID of the seller.
sharedContext
Context
A context used to share resources, such as transaction manager, between the application and the module.

Returns

Promise
Promise<void>
Resolves when the seller is deleted successfully.

retrieveSeller

This section provides a reference to the retrieveSeller method. This belongs to the Seller Module. This method retrieves a seller by its ID.

Example

const seller = await sellerModuleService.retrieveSeller("sel_123")
To retrieve relationships:
const seller = await sellerModuleService.retrieveSeller(
  "sel_123",
  {
    relations: ["members", "onboarding", "invites"],
  }
)

Parameters

id
string
required
The ID of the seller.
config
FindConfig<SellerDTO>
The configurations determining how the seller is retrieved. Its properties, such as select or relations, accept the attributes or relations associated with a seller.
sharedContext
Context
A context used to share resources, such as transaction manager, between the application and the module.

Returns

Promise
Promise<SellerDTO>
The retrieved seller.

listSellers

This section provides a reference to the listSellers method. This belongs to the Seller Module. This method retrieves a paginated list of sellers based on optional filters and configuration.

Example

To retrieve a list of sellers using their IDs:
const sellers = await sellerModuleService.listSellers({
  id: ["sel_123", "sel_321"],
})
To retrieve active sellers:
const sellers = await sellerModuleService.listSellers({
  store_status: "ACTIVE",
})
By default, only the first 15 records are retrieved. You can control pagination:
const sellers = await sellerModuleService.listSellers(
  {
    store_status: "ACTIVE",
  },
  {
    take: 20,
    skip: 2,
  }
)

Parameters

filters
FilterableSellerProps
The filters to apply on the retrieved sellers.
config
FindConfig<SellerDTO>
The configurations determining how the seller is retrieved.
sharedContext
Context
A context used to share resources, such as transaction manager, between the application and the module.

Returns

Promise
Promise<SellerDTO[]>
The list of sellers.

listAndCountSellers

This section provides a reference to the listAndCountSellers method. This belongs to the Seller Module. This method retrieves a paginated list of sellers along with the total count of available sellers satisfying the provided filters.

Example

const [sellers, count] = await sellerModuleService.listAndCountSellers({
  store_status: "ACTIVE",
})

Parameters

filters
FilterableSellerProps
The filters to apply on the retrieved sellers.
config
FindConfig<SellerDTO>
The configurations determining how the seller is retrieved.
sharedContext
Context
A context used to share resources, such as transaction manager, between the application and the module.

Returns

Promise
Promise<[SellerDTO[], number]>
The list of sellers along with their total count.

softDeleteSellers

This section provides a reference to the softDeleteSellers method. This belongs to the Seller Module. This method soft deletes sellers by their IDs.

Example

await sellerModuleService.softDeleteSellers([
  "sel_123",
  "sel_321",
])

Parameters

sellerIds
string[]
required
The IDs of the sellers.
config
SoftDeleteReturn<TReturnableLinkableKeys>
An object that is used to specify an entity’s related entities that should be soft-deleted when the main entity is soft-deleted.
sharedContext
Context
A context used to share resources, such as transaction manager, between the application and the module.

Returns

Promise
Promise<void | Record<string, string[]>>
An object that includes the IDs of related records that were also soft deleted. If there are no related records, the promise resolves to void.

restoreSellers

This section provides a reference to the restoreSellers method. This belongs to the Seller Module. This method restores soft deleted sellers by their IDs.

Example

await sellerModuleService.restoreSellers(["sel_123", "sel_321"])

Parameters

sellerIds
string[]
required
The IDs of the sellers.
config
RestoreReturn<TReturnableLinkableKeys>
Configurations determining which relations to restore along with each of the seller.
sharedContext
Context
A context used to share resources, such as transaction manager, between the application and the module.

Returns

Promise
Promise<void | Record<string, string[]>>
An object that includes the IDs of related records that were restored. If there are no related records restored, the promise resolves to void.

createMembers

This section provides a reference to the createMembers method. This belongs to the Seller Module.

createMembers(data, sharedContext?): Promise<MemberDTO[]>

This method creates members.

Example

const members = await sellerModuleService.createMembers([
  {
    seller_id: "sel_123",
    name: "John Doe",
    email: "[email protected]",
    role: "admin",
  },
])

Parameters

data
CreateMemberDTO[]
required
The members to be created.
sharedContext
Context
A context used to share resources, such as transaction manager, between the application and the module.

Returns

Promise
Promise<MemberDTO[]>
The created members.

createMembers(data, sharedContext?): Promise<MemberDTO>

This method creates a member.

Example

const member = await sellerModuleService.createMembers({
  seller_id: "sel_123",
  name: "John Doe",
  email: "[email protected]",
  role: "admin",
})

Parameters

data
CreateMemberDTO
required
The member to be created.
sharedContext
Context
A context used to share resources, such as transaction manager, between the application and the module.

Returns

Promise
Promise<MemberDTO>
The created member.

updateMembers

This section provides a reference to the updateMembers method. This belongs to the Seller Module.

updateMembers(id, data, sharedContext?): Promise<MemberDTO>

This method updates an existing member.

Example

const member = await sellerModuleService.updateMembers("mem_123", {
  name: "Jane Doe",
  role: "owner",
})

Parameters

id
string
required
The ID of the member.
data
UpdateMemberDTO
required
The attributes to update in the member.
sharedContext
Context
A context used to share resources, such as transaction manager, between the application and the module.

Returns

Promise
Promise<MemberDTO>
The updated member.

deleteMembers

This section provides a reference to the deleteMembers method. This belongs to the Seller Module.

deleteMembers(ids, sharedContext?): Promise<void>

This method deletes members by their IDs.

Example

await sellerModuleService.deleteMembers(["mem_123", "mem_321"])

Parameters

ids
string[]
required
The IDs of the members.
sharedContext
Context
A context used to share resources, such as transaction manager, between the application and the module.

Returns

Promise
Promise<void>
Resolves when the members are deleted successfully.

deleteMembers(id, sharedContext?): Promise<void>

This method deletes a member by its ID.

Example

await sellerModuleService.deleteMembers("mem_123")

Parameters

id
string
required
The ID of the member.
sharedContext
Context
A context used to share resources, such as transaction manager, between the application and the module.

Returns

Promise
Promise<void>
Resolves when the member is deleted successfully.

retrieveMember

This section provides a reference to the retrieveMember method. This belongs to the Seller Module. This method retrieves a member by its ID.

Example

const member = await sellerModuleService.retrieveMember("mem_123")
To retrieve the seller relationship:
const member = await sellerModuleService.retrieveMember(
  "mem_123",
  {
    relations: ["seller"],
  }
)

Parameters

id
string
required
The ID of the member.
config
FindConfig<MemberDTO>
The configurations determining how the member is retrieved.
sharedContext
Context
A context used to share resources, such as transaction manager, between the application and the module.

Returns

Promise
Promise<MemberDTO>
The retrieved member.

listMembers

This section provides a reference to the listMembers method. This belongs to the Seller Module. This method retrieves a paginated list of members based on optional filters and configuration.

Example

const members = await sellerModuleService.listMembers({
  seller_id: "sel_123",
})
To filter by role:
const members = await sellerModuleService.listMembers({
  seller_id: "sel_123",
  role: "admin",
})

Parameters

filters
FilterableMemberProps
The filters to apply on the retrieved members.
config
FindConfig<MemberDTO>
The configurations determining how the member is retrieved.
sharedContext
Context
A context used to share resources, such as transaction manager, between the application and the module.

Returns

Promise
Promise<MemberDTO[]>
The list of members.

listAndCountMembers

This section provides a reference to the listAndCountMembers method. This belongs to the Seller Module. This method retrieves a paginated list of members along with the total count of available members satisfying the provided filters.

Example

const [members, count] = await sellerModuleService.listAndCountMembers({
  seller_id: "sel_123",
})

Parameters

filters
FilterableMemberProps
The filters to apply on the retrieved members.
config
FindConfig<MemberDTO>
The configurations determining how the member is retrieved.
sharedContext
Context
A context used to share resources, such as transaction manager, between the application and the module.

Returns

Promise
Promise<[MemberDTO[], number]>
The list of members along with their total count.

softDeleteMembers

This section provides a reference to the softDeleteMembers method. This belongs to the Seller Module. This method soft deletes members by their IDs.

Example

await sellerModuleService.softDeleteMembers([
  "mem_123",
  "mem_321",
])

Parameters

memberIds
string[]
required
The IDs of the members.
config
SoftDeleteReturn<TReturnableLinkableKeys>
An object that is used to specify an entity’s related entities that should be soft-deleted when the main entity is soft-deleted.
sharedContext
Context
A context used to share resources, such as transaction manager, between the application and the module.

Returns

Promise
Promise<void | Record<string, string[]>>
An object that includes the IDs of related records that were also soft deleted. If there are no related records, the promise resolves to void.

restoreMembers

This section provides a reference to the restoreMembers method. This belongs to the Seller Module. This method restores soft deleted members by their IDs.

Example

await sellerModuleService.restoreMembers(["mem_123", "mem_321"])

Parameters

memberIds
string[]
required
The IDs of the members.
config
RestoreReturn<TReturnableLinkableKeys>
Configurations determining which relations to restore along with each of the member.
sharedContext
Context
A context used to share resources, such as transaction manager, between the application and the module.

Returns

Promise
Promise<void | Record<string, string[]>>
An object that includes the IDs of related records that were restored. If there are no related records restored, the promise resolves to void.

createMemberInvites

This section provides a reference to the createMemberInvites method. This belongs to the Seller Module. This method creates member invites with automatically generated JWT tokens.

createMemberInvites(data, sharedContext?): Promise<MemberInviteDTO[]>

Example

const invites = await sellerModuleService.createMemberInvites([
  {
    seller_id: "sel_123",
    email: "[email protected]",
    role: "member",
  },
])

Parameters

data
CreateMemberInviteDTO[]
required
The member invites to be created.
sharedContext
Context
A context used to share resources, such as transaction manager, between the application and the module.

Returns

Promise
Promise<MemberInviteDTO[]>
The created member invites with generated tokens.

validateInviteToken

This section provides a reference to the validateInviteToken method. This belongs to the Seller Module. This method validates a member invitation JWT token and returns the associated invite if valid.

Example

const invite = await sellerModuleService.validateInviteToken("eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...")

Parameters

token
string
required
The JWT invitation token to validate.

Returns

Promise
Promise<MemberInviteDTO>
The validated member invite.
This method throws an error if the invite has already been accepted or has expired.

updateMemberInvites

This section provides a reference to the updateMemberInvites method. This belongs to the Seller Module.

updateMemberInvites(id, data, sharedContext?): Promise<MemberInviteDTO>

This method updates an existing member invite.

Example

const invite = await sellerModuleService.updateMemberInvites("meminv_123", {
  accepted: true,
})

Parameters

id
string
required
The ID of the member invite.
data
UpdateMemberInviteDTO
required
The attributes to update in the member invite.
sharedContext
Context
A context used to share resources, such as transaction manager, between the application and the module.

Returns

Promise
Promise<MemberInviteDTO>
The updated member invite.

deleteMemberInvites

This section provides a reference to the deleteMemberInvites method. This belongs to the Seller Module.

deleteMemberInvites(ids, sharedContext?): Promise<void>

This method deletes member invites by their IDs.

Example

await sellerModuleService.deleteMemberInvites(["meminv_123", "meminv_321"])

Parameters

ids
string[]
required
The IDs of the member invites.
sharedContext
Context
A context used to share resources, such as transaction manager, between the application and the module.

Returns

Promise
Promise<void>
Resolves when the member invites are deleted successfully.

deleteMemberInvites(id, sharedContext?): Promise<void>

This method deletes a member invite by its ID.

Example

await sellerModuleService.deleteMemberInvites("meminv_123")

Parameters

id
string
required
The ID of the member invite.
sharedContext
Context
A context used to share resources, such as transaction manager, between the application and the module.

Returns

Promise
Promise<void>
Resolves when the member invite is deleted successfully.

retrieveMemberInvite

This section provides a reference to the retrieveMemberInvite method. This belongs to the Seller Module. This method retrieves a member invite by its ID.

Example

const invite = await sellerModuleService.retrieveMemberInvite("meminv_123")
To retrieve the seller relationship:
const invite = await sellerModuleService.retrieveMemberInvite(
  "meminv_123",
  {
    relations: ["seller"],
  }
)

Parameters

id
string
required
The ID of the member invite.
config
FindConfig<MemberInviteDTO>
The configurations determining how the member invite is retrieved.
sharedContext
Context
A context used to share resources, such as transaction manager, between the application and the module.

Returns

Promise
Promise<MemberInviteDTO>
The retrieved member invite.

listMemberInvites

This section provides a reference to the listMemberInvites method. This belongs to the Seller Module. This method retrieves a paginated list of member invites based on optional filters and configuration.

Example

const invites = await sellerModuleService.listMemberInvites({
  seller_id: "sel_123",
  accepted: false,
})

Parameters

filters
FilterableMemberInviteProps
The filters to apply on the retrieved member invites.
config
FindConfig<MemberInviteDTO>
The configurations determining how the member invite is retrieved.
sharedContext
Context
A context used to share resources, such as transaction manager, between the application and the module.

Returns

Promise
Promise<MemberInviteDTO[]>
The list of member invites.

listAndCountMemberInvites

This section provides a reference to the listAndCountMemberInvites method. This belongs to the Seller Module. This method retrieves a paginated list of member invites along with the total count of available member invites satisfying the provided filters.

Example

const [invites, count] = await sellerModuleService.listAndCountMemberInvites({
  seller_id: "sel_123",
  accepted: false,
})

Parameters

filters
FilterableMemberInviteProps
The filters to apply on the retrieved member invites.
config
FindConfig<MemberInviteDTO>
The configurations determining how the member invite is retrieved.
sharedContext
Context
A context used to share resources, such as transaction manager, between the application and the module.

Returns

Promise
Promise<[MemberInviteDTO[], number]>
The list of member invites along with their total count.

softDeleteMemberInvites

This section provides a reference to the softDeleteMemberInvites method. This belongs to the Seller Module. This method soft deletes member invites by their IDs.

Example

await sellerModuleService.softDeleteMemberInvites([
  "meminv_123",
  "meminv_321",
])

Parameters

memberInviteIds
string[]
required
The IDs of the member invites.
config
SoftDeleteReturn<TReturnableLinkableKeys>
An object that is used to specify an entity’s related entities that should be soft-deleted when the main entity is soft-deleted.
sharedContext
Context
A context used to share resources, such as transaction manager, between the application and the module.

Returns

Promise
Promise<void | Record<string, string[]>>
An object that includes the IDs of related records that were also soft deleted. If there are no related records, the promise resolves to void.

restoreMemberInvites

This section provides a reference to the restoreMemberInvites method. This belongs to the Seller Module. This method restores soft deleted member invites by their IDs.

Example

await sellerModuleService.restoreMemberInvites(["meminv_123", "meminv_321"])

Parameters

memberInviteIds
string[]
required
The IDs of the member invites.
config
RestoreReturn<TReturnableLinkableKeys>
Configurations determining which relations to restore along with each of the member invite.
sharedContext
Context
A context used to share resources, such as transaction manager, between the application and the module.

Returns

Promise
Promise<void | Record<string, string[]>>
An object that includes the IDs of related records that were restored. If there are no related records restored, the promise resolves to void.

createSellerOnboardings

This section provides a reference to the createSellerOnboardings method. This belongs to the Seller Module.

createSellerOnboardings(data, sharedContext?): Promise<SellerOnboardingDTO[]>

This method creates seller onboarding records.

Example

const onboardings = await sellerModuleService.createSellerOnboardings([
  {
    seller_id: "sel_123",
    store_information: true,
    stripe_connection: false,
    locations_shipping: false,
    products: false,
  },
])

Parameters

data
CreateSellerOnboardingDTO[]
required
The seller onboardings to be created.
sharedContext
Context
A context used to share resources, such as transaction manager, between the application and the module.

Returns

Promise
Promise<SellerOnboardingDTO[]>
The created seller onboardings.

updateSellerOnboardings

This section provides a reference to the updateSellerOnboardings method. This belongs to the Seller Module.

updateSellerOnboardings(id, data, sharedContext?): Promise<SellerOnboardingDTO>

This method updates an existing seller onboarding record.

Example

const onboarding = await sellerModuleService.updateSellerOnboardings("sel_onb_123", {
  store_information: true,
  stripe_connection: true,
})

Parameters

id
string
required
The ID of the seller onboarding.
data
UpdateSellerOnboardingDTO
required
The attributes to update in the seller onboarding.
sharedContext
Context
A context used to share resources, such as transaction manager, between the application and the module.

Returns

Promise
Promise<SellerOnboardingDTO>
The updated seller onboarding.

isOnboardingCompleted

This section provides a reference to the isOnboardingCompleted method. This belongs to the Seller Module. This method checks whether a seller has completed all onboarding steps.

Example

const isCompleted = await sellerModuleService.isOnboardingCompleted("sel_123")

Parameters

seller_id
string
required
The ID of the seller to check.

Returns

Promise
Promise<boolean>
A boolean indicating whether all onboarding steps are completed. Returns true if all four steps (store_information, stripe_connection, locations_shipping, products) are completed, otherwise false.

deleteSellerOnboardings

This section provides a reference to the deleteSellerOnboardings method. This belongs to the Seller Module.

deleteSellerOnboardings(ids, sharedContext?): Promise<void>

This method deletes seller onboardings by their IDs.

Example

await sellerModuleService.deleteSellerOnboardings(["sel_onb_123", "sel_onb_321"])

Parameters

ids
string[]
required
The IDs of the seller onboardings.
sharedContext
Context
A context used to share resources, such as transaction manager, between the application and the module.

Returns

Promise
Promise<void>
Resolves when the seller onboardings are deleted successfully.

deleteSellerOnboardings(id, sharedContext?): Promise<void>

This method deletes a seller onboarding by its ID.

Example

await sellerModuleService.deleteSellerOnboardings("sel_onb_123")

Parameters

id
string
required
The ID of the seller onboarding.
sharedContext
Context
A context used to share resources, such as transaction manager, between the application and the module.

Returns

Promise
Promise<void>
Resolves when the seller onboarding is deleted successfully.

retrieveSellerOnboarding

This section provides a reference to the retrieveSellerOnboarding method. This belongs to the Seller Module. This method retrieves a seller onboarding by its ID.

Example

const onboarding = await sellerModuleService.retrieveSellerOnboarding("sel_onb_123")
To retrieve the seller relationship:
const onboarding = await sellerModuleService.retrieveSellerOnboarding(
  "sel_onb_123",
  {
    relations: ["seller"],
  }
)

Parameters

id
string
required
The ID of the seller onboarding.
config
FindConfig<SellerOnboardingDTO>
The configurations determining how the seller onboarding is retrieved.
sharedContext
Context
A context used to share resources, such as transaction manager, between the application and the module.

Returns

Promise
Promise<SellerOnboardingDTO>
The retrieved seller onboarding.

listSellerOnboardings

This section provides a reference to the listSellerOnboardings method. This belongs to the Seller Module. This method retrieves a paginated list of seller onboardings based on optional filters and configuration.

Example

const onboardings = await sellerModuleService.listSellerOnboardings({
  seller_id: "sel_123",
})

Parameters

filters
FilterableSellerOnboardingProps
The filters to apply on the retrieved seller onboardings.
config
FindConfig<SellerOnboardingDTO>
The configurations determining how the seller onboarding is retrieved.
sharedContext
Context
A context used to share resources, such as transaction manager, between the application and the module.

Returns

Promise
Promise<SellerOnboardingDTO[]>
The list of seller onboardings.

listAndCountSellerOnboardings

This section provides a reference to the listAndCountSellerOnboardings method. This belongs to the Seller Module. This method retrieves a paginated list of seller onboardings along with the total count of available seller onboardings satisfying the provided filters.

Example

const [onboardings, count] = await sellerModuleService.listAndCountSellerOnboardings({
  seller_id: "sel_123",
})

Parameters

filters
FilterableSellerOnboardingProps
The filters to apply on the retrieved seller onboardings.
config
FindConfig<SellerOnboardingDTO>
The configurations determining how the seller onboarding is retrieved.
sharedContext
Context
A context used to share resources, such as transaction manager, between the application and the module.

Returns

Promise
Promise<[SellerOnboardingDTO[], number]>
The list of seller onboardings along with their total count.

softDeleteSellerOnboardings

This section provides a reference to the softDeleteSellerOnboardings method. This belongs to the Seller Module. This method soft deletes seller onboardings by their IDs.

Example

await sellerModuleService.softDeleteSellerOnboardings([
  "sel_onb_123",
  "sel_onb_321",
])

Parameters

sellerOnboardingIds
string[]
required
The IDs of the seller onboardings.
config
SoftDeleteReturn<TReturnableLinkableKeys>
An object that is used to specify an entity’s related entities that should be soft-deleted when the main entity is soft-deleted.
sharedContext
Context
A context used to share resources, such as transaction manager, between the application and the module.

Returns

Promise
Promise<void | Record<string, string[]>>
An object that includes the IDs of related records that were also soft deleted. If there are no related records, the promise resolves to void.

restoreSellerOnboardings

This section provides a reference to the restoreSellerOnboardings method. This belongs to the Seller Module. This method restores soft deleted seller onboardings by their IDs.

Example

await sellerModuleService.restoreSellerOnboardings(["sel_onb_123", "sel_onb_321"])

Parameters

sellerOnboardingIds
string[]
required
The IDs of the seller onboardings.
config
RestoreReturn<TReturnableLinkableKeys>
Configurations determining which relations to restore along with each of the seller onboarding.
sharedContext
Context
A context used to share resources, such as transaction manager, between the application and the module.

Returns

Promise
Promise<void | Record<string, string[]>>
An object that includes the IDs of related records that were restored. If there are no related records restored, the promise resolves to void.