The complete open source platform to run your entire marketplace. Storefront, vendor panel, admin console, and integrations in one enterprise-grade platform you own.
TypeScript b2b-marketplacecomposable-commerceecommerceenterpriseheadless-commercemarketplacemedusamedusajsmulti-vendortypescript
import type { SellerContext } from "@mercurjs/core/types/seller-context"
import { AuthenticatedMedusaRequest } from "@medusajs/framework/http"
import { MedusaError } from "@medusajs/framework/utils"
export function vendorSellerId(req: AuthenticatedMedusaRequest): string {
const context: SellerContext | undefined = req.seller_context
const sellerId = context?.seller_id
if (!sellerId) {
throw new MedusaError(MedusaError.Types.UNAUTHORIZED, "No seller in context")
}
return sellerId
}