npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@koda-plus/medusa-plugin-trade-credit

v0.1.0

Published

Trade Credit by Koda Plus: per-customer credit limits and payment terms (net 14/30/60) for B2B stores. The used amount from the customer's unpaid orders, due dates per order, an overdue check, a blocking toggle and the customer's own limit in the storefro

Readme

Trade Credit by Koda Plus

Credit limits and payment terms for B2B customers, right where the store is run: net 14, 30 or 60 days, the used amount from the customer's unpaid orders, due dates per order, an overdue check and a blocking toggle. The customer sees their own limit, the used amount and the open invoices in the storefront.

A wholesaler does not sell on prepayment alone: its customers buy on invoice with terms. This plugin keeps who may owe what, what is owed now and what is past due, in the Medusa admin, and reflects the same state to the customer's account.

Live demo: Medusa admin medusa.koda.plus/app/credit, signed in to a public demo account by the link itself. The demo storefront demo.koda.plus shows the credit card in the account panel.

What it does

  • Credit limits per customer: how much a customer may owe, the used amount from their unpaid orders, and what is left.
  • Payment terms: net 0 (immediate), 14, 30 or 60 days. An order placed by a customer with terms gets a due date.
  • Credit orders: every order on a customer's account, with its due date and its state (open, overdue, paid). The daily job flips open orders past their due date to overdue and open orders whose payment was captured to paid.
  • Blocking and pausing: a blocked customer is flagged everywhere and, with enforce: true, the store refuses to complete their cart.
  • The customer's own credit: the limit, the used and remaining amounts, the terms and the open invoices, through the store API.

Features

  • One page in the admin: set the terms of a customer (a search finds them by name or e-mail), the limits with their used and remaining amounts and a blocking toggle, and the open credit orders with their due dates, in English and Polish.
  • Live used amounts: the used amount is the sum of the customer's open and overdue credit orders, recomputed by the daily job and after every placed order.
  • Denormalized customer names: the panel lists the customer's name and e-mail next to the limit, with a link to the customer.
  • Demo mode (demo: true): sample limits and credit orders, flagged demo.
  • Enforcement (enforce: true): the store's cart completion answers 403 credit_hold for a customer over their limit or blocked. Off by default, so the store keeps selling and the panel shows the state.
  • The koda.integration/1 contract: one line per customer with credit terms on their page, and the board counter of limits to check.

Requirements

  • Medusa 2.12 to 2.21 and Node.js 20+ (see Compatibility).
  • Postgres, as every Medusa store has.

Installation

npm install @koda-plus/medusa-plugin-trade-credit

Yarn and pnpm work the same way: yarn add @koda-plus/medusa-plugin-trade-credit or pnpm add @koda-plus/medusa-plugin-trade-credit.

Configuration

Add the plugin to medusa-config.ts:

module.exports = defineConfig({
  // ...
  plugins: [
    {
      resolve: "@koda-plus/medusa-plugin-trade-credit",
      options: {
        // Everything is optional.
        enforce: false,
        demo: process.env.CREDIT_DEMO === "true",
      },
    },
  ],
})

Run the migrations, then open Credit in the admin sidebar:

npx medusa db:migrate

The migration creates two tables of the module: credit_limit and credit_order.

Options

Every option has a default, so the plugin starts without any.

  • demo (boolean, default false): demo mode. Sample limits and credit orders, flagged demo.
  • enforce (boolean, default false): with true, the store refuses to complete a cart for a customer over their limit or blocked (403 credit_hold).

Admin API

  • GET /admin/credit - the limits, the open credit orders and the counters.
  • POST /admin/credit/limits - creates or updates the terms of a customer ({ customer_id, limit_amount, net_days, currency_code? }).
  • POST /admin/credit/limits/:id - changes the amount, the terms, the blocking toggle or the status.

Store API

  • GET /store/credit/me - the logged-in customer's own limit and open credit orders. Reads only.

Compatibility

Medusa 2.12 through 2.21. The admin extension mounts through the Medusa admin SDK; the plugin's admin libraries are optional peers, so the app keeps the dashboard's own copies.

License

MIT