Skip to main content
Creates a seller with pending_approval status, ensures the default seller roles exist, creates (or reuses) the owner member, and links the member’s auth identity via app metadata. Optionally sets the seller address, professional details, and payment details in the same run. Triggered by POST /vendor/sellers during vendor registration. Emits seller.created.

Usage

import { createSellerAccountWorkflow } from "@mercurjs/core/workflows"

const { result } = await createSellerAccountWorkflow(container).run({
  input: {
    auth_identity_id: "authid_123",
    seller: { name: "Acme", email: "hello@acme.co", currency_code: "usd" },
    member_email: "owner@acme.co",
    first_name: "Jane",
    last_name: "Doe",
  },
})

Input

auth_identity_id
string
required
Auth identity to bind to the owner member.
seller
CreateSellerDTO
required
Seller to create; status is forced to pending_approval.
member_email
string
Email for the new owner member; required when member_id is not provided.
member_id
string
Existing member to link as owner instead of creating one.
first_name
string
Owner member first name.
last_name
string
Owner member last name.
address
UpdateSellerAddressDTO
Seller address to set after creation.
professional_details
UpdateProfessionalDetailsDTO
Professional details to set after creation.
payment_details
UpdatePaymentDetailsDTO
Payment details to set after creation.
additional_data
object
Custom data passed through to the workflow hooks.

Result

result
SellerDTO
The created seller.

Hooks

  • sellerAccountCreated — runs after the account is assembled with { seller, additional_data }.
createSellerAccountWorkflow.hooks.sellerAccountCreated(async ({ seller }) => {
  // provision extra resources for the new seller
})