packages/core/src/links connect its records to sellers and orders. Read across them with query.graph, and query a link’s own table by its entry name.
Seller and payout account
Defined inseller-payout-account-link.ts between SellerModule.linkable.seller and PayoutModule.linkable.payoutAccount. Neither side is a list, so a seller has one payout account and an account belongs to one seller. validateSellerPayoutAccountStep enforces the one-account rule before a new link is created.
Payout and seller
Defined inpayout-seller-link.ts between PayoutModule.linkable.payout, marked isList: true, and SellerModule.linkable.seller. A seller has many payouts, and each payout has one seller. createOrderPayoutsWorkflow creates this link when it creates a payout.
entity: "payout_seller" and filters on seller_id and payout_id.
Order and payout
Defined inorder-payout-link.ts between Medusa’s OrderModule.linkable.order and PayoutModule.linkable.payout, marked isList: true. createOrderPayoutsWorkflow creates it with the payout. The payout also stores order_id in its own unique column, which is what keeps an order from being paid twice; the link is there so you can read across modules with query.graph:
refund_id names the Medusa refund they reverse.