Business Credit for Vendure
The credit-customer platform for Vendure B2B: applications, invitations and auto-approval, per-customer limits with an audit trail, multi-user company accounts, Pay on Account with net-terms invoices, prepaid funds, settlements by any method with Stripe pay links, payment plans, statements, dunning and a reward-points programme — in one admin dashboard and one storefront API.
Install on Vendure: add the package with npm, yarn or pnpm, then register BusinessCreditPlugin in vendure-config.ts. All steps
npm
npm install @huloglobal/vendure-plugin-business-credit yarn
yarn add @huloglobal/vendure-plugin-business-credit pnpm
pnpm add @huloglobal/vendure-plugin-business-credit Register it in vendure-config.ts
// vendure-config.ts
import { BusinessCreditPlugin } from '@huloglobal/vendure-plugin-business-credit' ;
export const config: VendureConfig = {
plugins: [
BusinessCreditPlugin.init({
publicBaseUrl: 'https://shop.example.com' ,
licenceKey: process.env.HULO_LICENCE_KEY_BUSINESS_CREDIT,
}),
// ... your other plugins
],
};What it does
Built for production from day one.
Vendure has no concept of a credit account. Business buyers expect one: apply for terms, get a limit, order without a card, receive an invoice due in 30 days, pay by bank transfer or card when the statement arrives. Business Credit adds all of it server-side. Customers apply from the storefront; you approve with a limit and net terms. A business-credit payment handler and eligibility checker show Pay on Account only to customers with an active account and enough available credit, and issue a numbered invoice with a due date the moment the order is placed. Every settlement — bank transfer, card through a Stripe pay link, direct debit, cheque, cash, credit note or write-off — is allocated oldest-first across open invoices, with overpayments held as account credit. Limits can be raised permanently or temporarily with an expiry, every change logged with who and why. A daily run marks invoices overdue, sends reminders on a schedule you set, applies late fees if you want them, suspends accounts that go too far past due, and emails monthly statements with an aging summary (with a licence; the one-click reminder on an invoice is free). Customers see their limit, available credit, invoices and statements through a small REST API you can drop into any storefront. Customers can also pay money in ahead of time: prepaid funds are held on the account and settle new orders the moment they are placed. You can add colleagues to a company account with buyer or viewer roles and raise invoices by hand for work that never went through the checkout. With a licence, account holders invite colleagues themselves, you can invite a business straight to an approved account by email, applications that meet your rules are approved automatically, an overdue invoice can be put on an instalment plan, and an optional reward-points programme earns points on paid orders and invoices and lets customers spend them at checkout or against an invoice. Every account gets a review date.
Credit applications and approvals
Free: a storefront application form (company, registration and VAT numbers, requested limit and terms, trade references) lands in an admin queue. Approve with a limit and net terms, or reject with a note; the customer is emailed either way and the account is created on approval.
Limits with an audit trail
Permanent or temporary limit changes (a temporary increase expires on a date you set), each recorded with the old value, new value, reason and administrator. Available credit is derived live: effective limit minus open invoices plus any credit balance.
Pay on Account at checkout
The business-credit payment handler settles the order and issues a numbered invoice with a due date; the eligibility checker hides the method from customers without an active account, enough available credit, or with an overdue hold. Purchase-order numbers can be required.
Settlements by any method
Record bank transfers, direct debits, cheques, cash, credit notes and write-offs, or send a Stripe pay link for card payment (one invoice on the free tier; several at once with a licence); the signed webhook records the settlement. Allocation is oldest-first or explicit per invoice; overpayment becomes account credit and is applied to the next invoices automatically.
Statements with aging
Per-account statements for any period: opening balance, every charge and payment, closing balance, and aging buckets (current, 1–30, 31–60, 61–90, 90+). HTML for the admin and the customer, and, with a licence, emailed monthly on the statement day.
Reminders, late fees, auto-suspend
With a licence, a daily run sends reminders before, on and after the due date on a schedule you set per channel, applies a monthly late fee pro rata if configured, and suspends accounts that go more than N days overdue — reactivate with one click once they pay. On every tier, Remind on an open invoice e-mails the customer a reminder now.
Invoices raised by hand
Bill an account for work or goods that never went through the checkout: typed lines, PO, terms and a note. The invoice counts against the credit limit like an order on account and is e-mailed with its lines. Free.
Prepaid funds
You record a deposit or, with a licence, customers top up by card from the storefront; the money is held on the account and settles invoices and new on-account orders automatically. Prepaid-only accounts work with a zero credit limit.
Company accounts, invitations and auto-approval
One account, several logins: an admin adds colleagues as buyers or viewers (free), and with a licence the account holder can invite them from the storefront. Also licensed: invite a business by email straight to an approved limit, and approve applications that meet your rules — company number, order history, spend — on the spot. Every account carries a review date.
Payment plans
With a licence, split an outstanding invoice into instalments with their own due dates; reminders and overdue logic follow the plan, late fees pause, and customers can request a plan from their account.
Reward points
With a licence, an optional loyalty programme per channel: points per pound with tiers and multipliers, earned on paid orders and on invoices raised by hand, redeemed at checkout as a discount or against an open invoice, with expiry and adjustments. Your storefront shows the balance and history from the customer REST API.
Customer-facing REST API
/business-credit/my/* gives your storefront the account summary, funds, invoices, statements, pay links, team members, invitations, payment-plan requests and reward points for the signed-in customer, plus the application form; the statement also comes as a ready-made HTML page (my/statement?format=html). Rate-limited where it matters (applications, invitations, invitation links). Works with Qwik, Next.js, Remix or plain fetch.
Admin dashboard
Overview (exposure, overdue, credit held, due this week, aging), Accounts with a full detail panel, Applications queue, Invoices, Settlements, Settings with email preview and a run-now button, plus the Licence & billing card. Light and dark themes.
MySQL, MariaDB & PostgreSQL
The plugin follows whatever database your Vendure dbConnectionOptions use — no configuration. Verified against PostgreSQL 17; MySQL/MariaDB installs are unchanged.
Buy & activate from the admin
The 14-day evaluation starts by itself, with no card. Subscribe or buy lifetime from the plugin's admin page — checkout opens in a new tab and the key installs itself within a minute, renewals included. The same card shows your plan, first-charge date and a Manage billing link to the Stripe portal (update card, cancel, switch plan). Already have a key? Paste it into the same banner. No .env edit, no redeploy; environment keys still take precedence for infrastructure-as-code setups.
Weekly report, set-up checklist & dashboard widget
With a licence (or during the first 14 days), every Monday the plugin emails whoever runs the store a short report of what it did that week — real numbers from your own database, week-over-week, with the next set-up step to take — and the plugin page opens with a set-up checklist that hides itself once everything is done. Change the recipient, send a test or switch the report off from the plugin's Settings tab (needs the host's SMTP_* settings). If the licence lapses, the report stops and the checklist is hidden; their settings are kept. The dashboard widget (Dashboard → Add widget) is free and shows the plugin's recent numbers.
One-click in-app updates
When a new version ships, an update banner shows current → latest with a What's-new link to the changelog. "Update now" installs the registry-verified release via your project's own package manager (yarn/npm/pnpm auto-detected) and gracefully restarts under pm2/systemd. Disable with HULO_SELF_UPDATE=off.
Install
Three steps, five minutes.
Add the package
Or run the one-line installer that does steps 1–3 for you:
Prefer to do it by hand?
npm
yarn
pnpm
Register it
In your vendure-config.ts:
Compile the admin UI
Add the extension to your compileUiExtensions call so the plugin's page appears in the admin:
That's it. Restart Vendure and the plugin's page is in the admin with every feature on for 14 days — no card, no key. To keep it all on afterwards, open the page and click Subscribe (first charge when the 14 days end) — the key installs itself, no .env edit, no redeploy.
Free tier vs licensed
Try the whole thing, keep the core for free.
Every new install has every feature on for its first 14 days, with no card and no key. After that the free tier keeps working indefinitely, and a licence keeps the licensed features on. If a licence lapses, the licensed features stop and nothing is deleted.
Free tier (after the 14 days)
- Accounts and credit limits with the audit trail
- Pay on Account (purchase-order numbers included) and the eligibility checker
- Invoices, including invoices you raise by hand with lines; credit notes, settlements and statements
- Credit applications from the storefront
- Paying one invoice online by card
- One-click reminder on an invoice
- Company members added by an admin
- Rate limits on applications, invitations and invitation links
First 14 days + licensed
- Automatic reminders, late fees and auto-suspend
- Statement e-mails and the review-due e-mail
- Payment plans
- Card pay links for several invoices at once, and card top-ups
- CSV exports
- Invitations, auto-approval and account holders inviting colleagues
- Reward points, including points earned on invoices and spent against them
- The weekly report and set-up checklist
HTTP endpoints
Every route exposed.
/business-credit/dashboardAdmin: exposure, overdue, aging, top accounts/business-credit/accountsAdmin: accounts with availability/business-credit/accounts/:id/limitAdmin: permanent or temporary limit change/business-credit/accounts/:id/statusAdmin: suspend / reactivate / close/business-credit/applicationsAdmin: credit application queue/business-credit/applications/:id/approveAdmin: approve with limit + terms/business-credit/invoicesAdmin: invoices with balance + days overdue/business-credit/settlementsAdmin: record a settlement (any method)/business-credit/invoices/:id/pay-linkAdmin: Stripe pay link for an invoice/business-credit/stripe-webhookStripe: signed webhook for card settlements/business-credit/accounts/:id/statementAdmin: statement for a period/business-credit/dunning/runAdmin: run reminders / fees / suspensions now/business-credit/my/accountShop: limit, available credit, terms, status/business-credit/my/applyShop: apply for a credit account/business-credit/my/invoicesShop: my invoices/business-credit/my/invoices/pay-linkShop: pay an invoice by card (several at once: licensed)/business-credit/my/top-upShop: add prepaid funds by card (licensed)/business-credit/my/membersShop: the account holder adds a colleague (licensed)/business-credit/my/invitations/acceptShop: accept an invitation to an approved account/business-credit/invitationsAdmin: invite a business by email (licensed)/business-credit/invoices/:id/planAdmin: put an invoice on an instalment plan (licensed)/business-credit/my/loyalty/redeemShop: spend reward points on the active order (licensed)/business-credit/loyalty/statsAdmin: points outstanding, earned and redeemed (licensed)/business-credit/metaAdmin: licence + evaluation + update status/business-credit/licence/activateAdmin: activate a licence key from the admin UI/business-credit/update/runAdmin: one-click in-app update + graceful restart/business-credit/digest/settingsAdmin: weekly report recipient, last/next send/business-credit/digest/send-testAdmin: email this week's report to you now/business-credit/setupAdmin: set-up checklist (what is still to do)/business-credit/widgetAdmin: headline figures for the dashboard widgetFAQ
Common questions.
How do I get a licence key?
Buy one on the web with Stripe Checkout: monthly licence for Business Credit, annual licence for Business Credit (two months free) or lifetime licence for Business Credit. You'll receive the JWT key by email. Paste it into the plugin's admin settings (Activate) — no redeploy — or set it as HULO_LICENCE_KEY_BUSINESS_CREDIT in your .env if you prefer config-as-code; the env key wins when both are present.
Does it work without a key?
Yes. Every install runs with all premium features on for its first 14 days — no card, no licence key, nothing to configure — so you can judge it on your real traffic. After that it keeps working in the free tier. To keep them, click Subscribe on the plugin's admin page: the first charge is taken when the 14 days end (or 49 hours after checkout, if that is later), you can cancel any time before then, and the licence installs itself.
Which databases are supported?
MySQL, MariaDB and PostgreSQL (verified against PostgreSQL 17). The plugin follows your Vendure dbConnectionOptions automatically — there is nothing to configure.
How do updates work?
The plugin checks the npm registry daily. When a newer version exists, the admin dashboard shows an update banner with a What's-new link to the changelog and an "Update now" button that installs the registry-verified release via your own package manager and gracefully restarts under your process supervisor. Prefer manual control? Copy the install command instead, or set HULO_SELF_UPDATE=off.
Where is data stored?
In your Vendure database: the plugin keeps its data in its own tables there, created on boot. Hulo Global never receives your customer data: the plugin sends our licence server only the licence check-ins and usage counts described under “Do the plugins call home?”. Card pay links and top-ups are created in your own Stripe account.
Will it survive a Vendure upgrade?
It supports Vendure >=3.5.0 <4.0.0 (its peer dependency), and current releases are built and tested against Vendure 3.8.2 before they are published. A boot-time compatibility check emits a non-fatal warning if @vendure/core is outside that range, so upgrades to a future 3.x are safe to try. The 4.0 line will be tested and re-declared once its changelog lands.
Changelog
What's new.
Latest release: v0.6.0, 16 November 2026. Full changelog for Business Credit for Vendure
v0.6.0NewLatest
Changed — e-mails
- Every e-mail restyled into one mail-client-safe layout: a 600px white card on a light grey background, your logo or the channel's business name over a 3px accent bar, a heading per kind, the body, a button, the sign-off (with your support address on customer e-mails) and a footer strip with the channel's e-mail footer. Label lines become an info box, the remittance text a "How to pay" box, an overdue invoice and a suspension reason an amber notice. Inline styles and tables only (no
<style>block), every value escaped. Applies to: application received / approved / rejected, invoice issued, payment received, reminders (before due, due, overdue — late fees show in the amounts), suspension, statement, invitation, member added, member invited, payment plan, loyalty tier change; the merchant notices (new application, invitation accepted, plan requested, review due) use a compact version. - Statement e-mails carry the statement as an inline-styled table (account activity, open invoices, aging). It used to be the web page's markup, whose styling mail clients stripped.
- The plain-text part is unchanged and still sent with every e-mail; customer e-mails add the support address under the sign-off when one is configured. Wording: "e-mail", "View and pay".
Added
- Plugin option
email:{ accentColor?, logoUrl?, logoWidth?, supportEmail? }(default accent#155dfc; the support address defaults to the channel's reply-to). Existing settings — business name, reply-to, footer, remittance text — keep working as before. - Exports
renderLayout,emailBranding,HEADINGS,renderHeading,MERCHANT_KINDS.
Fixed
- CSV exports (invoices, settlements, ledger, loyalty) prefix text cells that start with
=,+,-,@, tab or CR with an apostrophe, so a company name, purchase order or reference typed by a customer cannot run as a spreadsheet formula. Numbers are unchanged. - Storefront pay links and top-ups are rate-limited (20 per 10 minutes per customer; each creates a Stripe Checkout Session), and payment-plan requests (each e-mails you) to 5 an hour per account; 429
rate_limitedwithretryAfterSeconds. POST /business-credit/my/invoices/pay-linkno longer needssuccessUrl/cancelUrl(it answered 400missing_urls); they default to the storefront's credit page, as the admin route does. Return URLs sent by the storefront must be absolute http(s) URLs (400invalid_url).
Dependencies
mysql2(dev) ^3.24.6. Held back (majors):typescript7,vitest5 (the monorepo harness pins 2.1.9),nodemailer10 /@types/nodemailer8 (the peer range stays>=6),@types/node26,typeorm1.x (Vendure 3.x ships TypeORM 0.3). Peer@vendure/core >=3.5.0 <4.0.0unchanged.
v0.5.0New
Parity with the WordPress editions (HULO Business Credit / Business Credit Pro): what is free on WordPress is free here too, the weekly report and the setup checklist move to the licensed tier, and the WordPress-only features are ported.
Changed — tiers
- Free now: credit applications from the storefront (
POST /business-credit/my/apply; the per-channel switch still turns them off, and auto-approval rules stay licensed), and paying one invoice online — a Stripe pay link for a single invoice from the admin or the storefront. A link covering several invoices at once and card top-ups stay licensed (card_pay_links).GET my/invoicesandGET my/invoices/:idreportcardPayLinks: trueand a newmultiInvoicePayLinks. - Licensed now: the weekly e-mail report and the setup checklist (
weekly_report,setup_checklist; also during the 14-day evaluation). On the free tier the report is not sent, andsetup,digest/preview,digest/send-testandPOST digest/settingsanswer 402;GET digest/settingsstill reads withlocked: true. When a licence lapses both stop at the next hourly check; settings and history are kept and apply again with a licence. PREMIUM_FEATURESno longer listsstorefront_applicationsand addsweekly_reportandsetup_checklist; the order (and so the first five shown in the banner) is now automatic reminders, late fees, auto-suspend, statement e-mails, payment plans.
Added
- Invoices raised by hand (free):
POST /business-credit/accounts/:id/invoiceswith typed lines (description,quantity,unitPriceMinor), PO, terms, an internal note,overrideLimitandsendEmail; Raise invoice on the account's Invoices pane. The invoice has no order (orderId: null,source: 'manual',lines), is decided under the per-account lock with the same rules as Pay on Account and joins the account's exposure at once. The admin may overrideover_limit,overdue_holdandpo_required(recorded oninvoice.issued), never a suspended, pending or closed account. Held funds are applied to it, and theinvoice_issuede-mail lists its lines. New columnbusiness_credit_invoice.lineItems(added on upgrade). - One-click reminder (free):
POST /business-credit/invoices/:id/remindand Remind on every open invoice e-mail a payment reminder now (before due / due today / overdue, or the next instalment of a plan) without touching the automatic schedule; a second one within a minute is refused (409recently_reminded). - Points on invoices raised by hand (licensed
loyalty): earned once, when the invoice is paid in full, on its amount less any points redeemed against it. - Redeem points against an invoice (licensed
loyalty):GET /business-credit/my/loyalty/invoices/:id(what may be spent) andPOST /business-credit/my/loyalty/redeem-invoice { invoiceId, points }— the value is booked as acredit_notesettlement on the invoice; owners and buyers only. New columnbusiness_credit_loyalty_tx.invoiceId(added on upgrade). - Rate limits (per server process): storefront applications 5 an hour per customer and 20 an hour per IP; colleague invitations 5 an hour and 20 a day per account; the public invitation-token lookup 30 a minute per IP; accepting an invitation 10 tries per 10 minutes. Over the limit: 429
rate_limitedwithRetry-After.
Fixed
- The review-due e-mail to the merchant was sent on the free tier through the event path although the daily pass treats it as licensed. It is now licensed throughout, as in the WordPress edition; the review flag stays free.
Documentation
- The README and the admin page now say that company members added by an admin are free; only the account holder inviting colleagues from the storefront is licensed (
members). The README states that the plugin ships a storefront REST API, not storefront pages, and documents everything above. Theinvoice_issuede-mail now opens with{{invoiceIntro}}(the order thank-you, or "We have raised the invoice below" for an invoice raised by hand), lists{{lineItems}}, and says "Available credit now".
v0.4.6NewSecurity
- Security Admin REST routes refuse a Shop-API session on Vendure 3.8+. Vendure 3.8 binds every session to the API it was created on and refuses Shop-API sessions on the Admin API (GHSA-5fpx-9m35-w745), but it does not check REST routes added by plugins: an administrator's storefront session still carried their admin permissions into the Business Credit admin REST routes (accounts, settlements, dunning, loyalty, licence). Those routes now also require a session created on the Admin API (
isAdminApiSessionfrom the licence SDK 0.15.6, the same rule as Vendure's own AuthGuard). The admin UI is unaffected; administrators logged in before the 3.8 upgrade log in again once, as Vendure already requires. No change on Vendure 3.5 to 3.7.
Compatibility
- Tested with Vendure 3.8.2 (NestJS 12,
@nestjs/graphql14, Apollo Server 5), as well as 3.5 to 3.7. The peer range stays@vendure/core >=3.5.0 <4.0.0; nothing here needs 3.8. - Requires
@huloglobal/vendure-licence-sdk^0.15.6.
v0.4.5New
Package metadata
- The
licensefield is nowAGPL-3.0-only, matchingLICENSE, which grants the GNU Affero General Public License version 3 (it saidAGPL-3.0-or-later). Published npm builds remain under the separate commercial licence described inLICENSE. No code changes.
v0.4.4NewSecurity
- Security Admin downloads are no longer kept by CDNs. The CSV exports (
GET /business-credit/export/:kind.csv,GET /business-credit/loyalty/export.csv) and the printable statement (GET /business-credit/accounts/:id/statement.html) now sendCache-Control: private, no-store, on their refusals and errors too. They used to send no caching header, so a CDN that caches by file extension (Cloudflare caches.csvby default, even for a signed-in request) could store one admin's export and serve it to anyone who asked for the same URL. If your admin API is behind a CDN, purge any/business-credit/CSV files it may already hold.
Fixed
- PostgreSQL: the checks that stop double processing now hold. With licence SDK 0.15.3 or older, every conditional
UPDATEon Postgres reported 2 affected rows. The checks that stop two requests or two runs doing the same work at the same moment therefore always passed. On Postgres:- two redemptions at the same moment could spend the same loyalty points, and one redemption could be given back twice;
- overlapping runs could allocate a settlement's money twice, book a period's late fee twice, or send the same statement twice;
- two invoices created at the same moment could get the same number.
The plugin now requires licence SDK
^0.15.4, which reports the real count. The auto-suspend and invitation-expiry steps now ask for the count too, so overlapping dunning runs no longer send a second suspension e-mail. MySQL and MariaDB were not affected. - PostgreSQL: the first weekly report is no longer skipped (it used to start a week late; fixed in licence SDK 0.15.4).
- PostgreSQL: a licence key activated in the admin is now stored. The plugin's licence store left out the conflict column that the Postgres upsert needs, so saving a key failed. Pasting a key into the admin applied it, answered with a server error and did not store it, so the plugin was unlicensed again after a restart. A key bought from the admin, which installs itself, was not stored either. MySQL and MariaDB were not affected.
Package metadata
homepageis now the product page, https://huloglobal.com/vendure-plugins/business-credit/. Therepositoryandbugslinks pointed at a private GitHub repository that visitors cannot open:repositoryis removed andbugsis support@huloglobal.com.- A shorter
descriptionthat npm shows in full (npm cuts descriptions at 255 characters). - The npm package no longer includes the plugin's compiled unit tests.
v0.4.3New
Documentation
- The README now shows the plugin logo, hosted on huloglobal.com so it displays on npm and GitHub alike, linking to the product page. No code changes.
v0.4.2NewSecurity
- Security Held funds could settle several invoices at once.
applyCreditBalance(run by theinvoice.issuedsubscriber, deposits, top-up webhooks, the daily pass and Apply credit) read each settlement's unallocated money and wrote it back afterwards with no lock, so concurrent passes applied the same funds repeatedly — six simultaneous passes turned 80.00 of held funds into 480.00 of invoice payments. It now runs under the per-account database lock and claims each settlement's money with a conditional decrement (unallocatedMinor >= ?) before booking anything.recordSettlementandrefundSettlementtake the same lock, so a payment or refund cannot interleave with an application on the same account. A lock held elsewhere for more than 30 s answers 409account_busy(Stripe retries the webhook). - Security Members were enrolled without their consent. An account holder could add any registered customer of the channel by e-mail from the storefront; that customer was switched onto the holder's company account at once (losing their own storefront application path) and the response disclosed their name and customer id. A storefront addition is now an invitation: the member row is
pending, gives no access and shows only the typed e-mail until that customer accepts it themselves (POST my/memberships/:memberId/accept, or.../decline; listed byGET my/membershipsand inGET my/accountasmemberInvitations). New e-mailmember_invited;member_addedis sent on acceptance. Existing members stay active; admin additions are unchanged. Storefronts that offer member management need an accept / decline control for invitees.
Added
business_credit_member.status(active/pending, defaultactive), added on boot. Eventsmember.invited(published) andmember.declined(audit only).
v0.4.1New
Changed
- Every install now gets a 14-day evaluation with all features on and no card (granted by the HULO licence server). The licence banner's buttons read Subscribe: during the evaluation the first charge falls on the day it ends, so there is no second free trial.
v0.4.0
Merchant engagement pass: a weekly report, a set-up checklist on the Overview, a dashboard widget, usage figures on the licence banner and real "collected / recovered / reminders sent" tiles. One new table (bc_dunning_run), created on boot; the shared hulo_plugin_prefs table from the licence SDK holds the report settings.
Added
- Weekly report — every Monday at 08:00 (server local time) the worker emails what the plugin did last week against the week before: applications received, accounts approved, invoices issued and their value, money collected, reminders sent, money recovered on overdue invoices, reward points issued — plus the next set-up steps and, on the free tier or during the evaluation, what a licence switches on. Goes to the channel's notification email by default (then the licence holder, then the evaluation reminder address); Settings → Weekly report changes the recipient, turns it off, sends a test or opens a preview. Needs SMTP (the plugin's
smtpoption or theSMTP_*environment). Endpoints:GET/POST /business-credit/digest/settings,POST digest/send-test,GET digest/preview. - Set-up checklist on the Overview (
GET /business-credit/setup): Pay-on-Account payment method enabled, credit terms saved, notification email set, SMTP configured, Stripe webhook secret configured, first account approved or invited — real checks, each with a hint and a link to the right tab. Hide puts it away until a step comes undone again; it disappears by itself once everything is done. The Settings tab's static status dots moved here. - Dashboard widget (Dashboard → Add widget → Business Credit): collected, invoiced and reminders sent over the last 7 days, the licence notice when one applies, and a link to the plugin page.
GET /business-credit/widget. - Usage figures —
GET metagainsnotice(trial ending / key expiring sentence),premiumFeatures,recentStats(the top three non-zero 30-day figures) andstats30; the Overview shows Collected (30d), Recovered after reminders (30d) and Reminders sent (30d); the trial and free banners show "So far: …" and the premium feature list; the trial banner has the "Email me before it ends" reminder (the existingeval/remind-me, which now also remembers the address for the weekly report). The same 30-day figures ride along with the daily evaluation ping and, after purchase, the heartbeat — numbers only, no personal data. bc_dunning_run— every daily pass is recorded (date, reminders sent, fees applied, suspended, statements sent, marked overdue, errors) so the reminders figure is real rather than inferred.
Changed
- Every 402
licence_requiredbody now carriesbuyUrl; the admin UI maps any 402 (andlicence-required/premium-featurebodies) to "<what you tried> needs a licence — start the free trial or activate a key at the top of this page." - Licence SDK
^0.15.1(PluginPrefs,WeeklyDigest,licenceLifecycleNotice,Heartbeat.setStatsProvider,licenceKeyProvider). - The heartbeat reports the jti of the key now in force — a key activated from the admin card or installed by the purchase claim no longer leaves it saying
unlicensed(which made the licence server drop the usage figures for those installs); deactivation sets it back.
v0.3.3
Performance pass on the admin overview and the daily run — no new schema, no migration.
Changed
POST /business-credit/dunning/runanswers202 { started: true }at once and runs the pass in the background (a full pass on a large install outlived reverse-proxy timeouts). The admin Run now button pollsdunning/statusevery 3 s and shows the report whenrunningturns false;dunning/statusgainedlastRun(completed/locked/failed).{ wait: true }keeps the synchronous response for scripts and tests.GET /business-credit/dashboardnow aggregates exposure, overdue (honouring each account's grace days), due-in-7-days, the aging buckets and the top-10 exposures in SQL instead of loading up to 20 000 invoice rows, and also returnspendingInvitations,activePlansand the channel'sloyaltystats. The admin UI loads the Overview with one call instead of five, keeps a 30 s freshness window per list (Refresh, a channel change or any mutation bypasses it), tracks table rows by id and runs withOnPushchange detection.- Loyalty monthly expiry finds the accounts with something to expire in one aggregate query per batch of 500 (
GROUP BY … HAVING) instead of one query per account. - Daily run fan-out: the storefront base URL is resolved once per channel; exposure and held credit for every account with a reminder due come from one
GROUP BY accountIdquery; newly-overdue invoices are marked with one bulkUPDATEand one multi-row eventINSERTper channel (same event payloads); on the statement day only accounts with ledger activity in the month or a non-zero opening balance are considered, five at a time. - Statement periods longer than 400 days are cut back to 400 days from
from(X-Statement-Clampedheader; the response'stosays where it ends); statement emails use the run's clock.
Fixed
- Loyalty expiry maths: a redeem that was later released (order abandoned) no longer counts as consumption, so the points it briefly held expire when their earnings expire instead of being sheltered.
- PostgreSQL: every column of Vendure's own tables the plugin reads (
customer.firstName/lastName/emailAddress/deletedAt,order.subTotalWithTax/shippingWithTax/customerId,order_channels_channelandcustomer_channels_channelkeys,channel.defaultCurrencyCode) is now quoted; TypeORM creates them camelCase on Postgres, so the unquoted reads failed there. Found by the newsrc/pg-corpus.test.ts, which runs every raw SQL statement of the package against a real PostgreSQL (skipped unlessHULO_PG_URLis set).
Documentation
- Calendar-day arithmetic (due dates, grace, reminder days, days overdue, late-fee days, statement day and period) is UTC — now said so in the README.
v0.3.2
Reliability and performance pass — no new features, no schema migration (two indexes, one unique index and one column are added on boot).
Fixed
- Credit limit race. The limit check and the invoice insert for an order paid on account now run under a per-account database lock with availability re-read inside it, so two orders placed at the same moment can no longer both squeeze through the last of a limit. A lock held for more than 10 s declines with
account_busy. - Settlements on the same invoice.
paidMinoris now incremented in the database (paidMinor = paidMinor + ?) with the paid/part-paid status decided from the live row, instead of written back from a copy loaded earlier; two payments landing together can no longer overwrite each other. - Duplicate Stripe settlements.
providerRefhas a unique index; a webhook delivered twice concurrently inserts once and returns the existing settlement asduplicate. - Crons across processes. The daily dunning pass and the loyalty sweep take a cross-process lock (
GET_LOCKon MariaDB/MySQL,pg_try_advisory_lockon Postgres). Late fees are additionally claimed with a conditionalUPDATEonlastFeeAppliedAt, and monthly statements are claimed on a newlastStatementPeriodcolumn before the email goes out — so an overlapping Run now or a second worker never charges or sends twice. - Loyalty double-spend. Redemptions and negative adjustments debit with a compare-and-set (
balancePoints >= ?); two simultaneous redemptions can no longer take a balance negative. Points are held before the surcharge is added and given back if the order update fails. - Tier downgrade email. A downgrade after a cancellation is audited but no longer emails the customer "you have reached the … tier".
- Viewers can no longer create pay links, top-ups or plan requests from the storefront (
403). - Closing an account that still holds unallocated credit is refused (
credit_held) until it is refunded. - Due dates cover the whole due day (23:59:59 UTC), so an invoice issued at 09:00 is not one second from overdue on its due date.
- Licence settings report
crons.enabledas it is resolved (trueonly when forced on this process); the evaluation lead request has a 10 s timeout.
Changed
- SMTP uses one pooled transport (3 connections, 10 s connect/greeting and 30 s socket timeouts) instead of a fresh TLS+AUTH session per email; a failed send drops the pool so the next email reconnects.
- Channel config is cached for 15 s per channel (every order, reminder and storefront page reads it); writes invalidate the cache.
formatMinorcaches itsIntl.NumberFormatand honours zero- and three-decimal currencies.- Plugin email columns are compared without
LOWER()(they are stored lower-case), so the indexes are used. - New indexes:
idx_bci_channel_issued,idx_bce_channel_created,idx_bclt_channel_created(the admin overview's loyalty stats no longer scan the whole transaction table). - The loyalty sweep loads only an order's surcharges instead of every relation.
v0.3.1
Changed
- Vendure plugin directory readiness. The plugin class, every service and the
BusinessCreditEventcarry@categoryJSDoc tags (Plugin / Services / Events); the runtimecompatibilitydeclaration now matches the tested range>=3.5.0 <4.0.0instead of^3.0.0. - README: npm, download, Vendure and database badges, a five-step Quick start at the top (including the admin-UI compile step and the payment-method setup) and a Compatibility section. No functional changes.
v0.3.0
The "credit customer platform" release: everything a trade customer needs beyond a limit and an invoice — colleagues on the same account, an invitation instead of an application, rules that approve good customers on the spot, periodic reviews, instalment plans for a struggling invoice, and points for every order.
Added
- Multi-user company accounts (members). The account holder (
owner) adds colleagues by e-mail asbuyer(may order on account) orviewer(invoices and statements only). Every storefront route, the Pay-on-Account handler and the eligibility checker now resolve "my account" throughAccountsService.resolveAccountForCustomer— the customer's own account, else the one they are a member of. A viewer at checkout is declined withmember_viewer("Your account role does not allow placing orders on account"). Admin:GET/POST /business-credit/accounts/:id/members,POST accounts/:id/members/:memberId { role },DELETE accounts/:id/members/:memberId. Storefront:GET /business-credit/my/members(owner or buyer),POST my/members { email, role }andDELETE my/members/:memberId(owner only; per-channel switchallowMemberManagement);GET my/accountgainsrole,isOwnerandmemberManagement. Refusals: 404no_customer, 409is_owner/already_member/owns_account, 400bad_role. Eventsmember.added(e-mails the new member),member.role_changed,member.removed. Tablebusiness_credit_member. Premiummembers. - Invitations. Offer an account on pre-agreed terms without an application:
POST /business-credit/invitations { email, creditLimitMinor, termsDays?, companyName?, message? }e-mails the invitee a 64-hex-character token link (<storefront>/account/credit/accept?token=…) that expires after the channel'sinvitationDays(default 14).GET invitations?status&email,POST invitations/:id/revoke,POST invitations/:id/resend(bumpssentCount). A publicGET /business-credit/invitations/:tokenfeeds the accept page with the terms and a masked e-mail (in***@example.com), never the token. The invitee signs in with the same address and callsPOST /business-credit/my/invitations/accept { token }→ an active account on the invited terms,approvedBy: 'invitation', first review one cycle out; the merchant's notify address getsinvitation_accepted. Refusals: 403email_mismatch, 409invitation_expired/invitation_not_pending/account_exists/invitation_pending. The daily pass expires stale invitations (invitationsExpiredin the report). Tablebusiness_credit_invitation. Premiuminvitations. - Auto-approval. With
autoApproveEnableda storefront application is approved on the spot (actorauto, note "Auto-approved by rule") when the customer has at leastautoApproveMinOrderssettled orders worthautoApproveMinSpendMinorin the channel and — ifautoApproveRequireCompanyNumber— gave a company number. The limit granted is the requested one (or the channel default) capped atautoApproveMaxLimitMinor; a rule whose cap is 0 never approves.POST /business-credit/my/applyanswers{ application, account, availability, autoApproved }. Anything that fails a check stayspendingfor a human. Premiumauto_approval; pure rule insrc/accounts/rules.ts. - Credit reviews. Every approval sets
reviewAt = now + reviewEveryMonths(default 12; 0 = off). Accounts carryreviewAt,reviewNoteandreviewDue;GET accounts?reviewDueOnly=trueand the dashboard'sreviewsDuelist what is waiting. The daily pass publishesaccount.review_dueand e-mailsreview_dueto the notify address (once, then again after 30 days).POST /business-credit/accounts/:id/review { note? }records the review and movesreviewAton one cycle (from today when it was long overdue). Eventaccount.reviewed. - Payment plans. Split an open invoice's balance into instalments:
POST /business-credit/invoices/:id/plan { instalments: 3 | [{ dueAt, amountMinor }], startAt?, intervalDays?, note? }(equal split with the last instalment taking the rounding, 2–60 instalments, default 30 days apart). Money allocated to the invoice pays the instalments in order; the plan completes when the invoice is paid and reopens on a refund. While a plan is active the daily pass judges lateness by the next unpaid instalment — marks itoverdue, sends the reminders against its due date (with an "instalment 2 of 3" line), charges no late fee, and counts auto-suspend from the overdue instalment.GET invoices/:id/plan,POST invoices/:id/plan/cancel { note? }(the invoice goes back to overdue when it is past its own due date),GET plans?channelId&accountId&invoiceId&status. Customers see the schedule onGET /business-credit/my/invoices/:id(plan) and can ask for one withPOST my/invoices/:id/plan/request { instalments, message? }→ 202 and aplan_requestede-mail to the merchant (per-channel switchallowCustomerPlanRequests). Eventsplan.created(e-mails the schedule),plan.requested,plan.completed,plan.cancelled,plan.reopened. Report gainsplanInstalmentsOverdue. Tablebusiness_credit_plan. Premiumpayment_plans. - Reward points (loyalty) programme. Per-channel config (
GET/POST /business-credit/loyalty/config):enabled,programmeName,earnPointsPer100Minor,redeemValueMinorPerPoint,minRedeemPoints,maxRedeemPercent,expiryMonths,signupBonusPoints,earnOnAccountOrders,tiers(default Bronze / Silver 2 000 / Gold 10 000 at ×1 / ×1.25 / ×1.5). Points are earned once per order onPaymentSettled(and onOrderPlacedEventfor orders that settle at once, de-duplicated):floor(totalWithTax / 100 × rate × tierMultiplier); a tier change e-mailstier_changed; cancelling the order writes areversal(clamped at zero) and releases any redemption. Redeeming at checkout:POST /business-credit/my/loyalty/redeem { points }validates the minimum, the balance and themaxRedeemPercentcap ofsubTotalWithTax(400below_minimum/insufficient_points/over_max_percentwithmaxPoints), then adds a negative surcharge (sku LOYALTY-POINTS, tax-inclusive) to the active order and books apendingredeem;POST my/loyalty/unredeemremoves it; placing the order finalises it; a second redeem replaces the first.GET my/loyalty→ balance, value, tier, next tier, expiring-soon, earn rate, redeem rules, pending redemption;GET my/loyalty/transactions; publicGET /business-credit/loyalty/preview?amountMinor=for product pages (the shopper's tier when signed in). Admin: accounts (search, tier), account detail,adjust(positive adjustments count towards tiers), transactions,stats,top-customers,export.csv(premiumexports),POST loyalty/run { expire? }.LoyaltyCronat 03:30 on the worker releases stale pending redemptions (7 days) daily and expires points on the 1st:expirable = max(0, min(balance, Σ expired credits − Σ every deduction)), oldest points consumed first. Tablesbusiness_credit_loyalty_config,business_credit_loyalty_account,business_credit_loyalty_tx. Premiumloyalty; when unlicensed or switched off nothing is earned and the storefront reads{ enabled: false }. - E-mails. Seven new kinds:
invitation,invitation_accepted,member_added,plan_created,plan_requested,review_due,tier_changed— all with preview and test-send. - Events.
account.created,invitation.created/accepted/revoked/expired,member.added/role_changed/removed,account.reviewed,account.review_due,plan.*,loyalty.tier_changed,loyalty.adjusted,loyalty.config_updated. - Channel config gains
autoApproveEnabled,autoApproveMaxLimitMinor,autoApproveMinOrders,autoApproveMinSpendMinor,autoApproveRequireCompanyNumber,reviewEveryMonths,invitationDays,allowCustomerPlanRequests,allowMemberManagement. - A second MariaDB end-to-end suite (
e2e/business-credit-platform.e2e-spec.ts) covering invitations, members and roles at checkout, auto-approval, reviews, payment plans through dunning and cancellation, plan requests, the reward programme end to end (earning, tiers, redeem / unredeem / replace / finalise, cancellation reversal, on-account earning, admin stats and exports, expiry) and the unlicensed behaviour of every new surface.
Fixed
GET /business-credit/my/accountofferedcanApply: trueto a customer who already trades through a company account they are a member of; it now considers the resolved account, not only the customer's own.addColumnIfMissinglooked upinformation_schema.columnswithout restricting it to the current database, so on a server hosting another database that already had a column (staging next to production, a second Vendure instance) the upgradeALTER TABLEwas skipped and the new column never appeared. The lookup is now scoped to the current database (DATABASE()on MySQL / MariaDB,current_database()+current_schema()on PostgreSQL).
v0.2.0
Added
- Prepaid funds. Money held on an account before any invoice exists. An admin deposit (
POST /business-credit/accounts/:id/deposit { method, amountMinor, reference?, receivedAt?, note? }; real payment methods only) or a customer card top-up through Stripe Checkout (POST /business-credit/my/top-up, admin-generated link viaPOST /business-credit/accounts/:id/top-up-link; premiumcard_pay_links) is applied to any open invoice at once and the remainder held as funds, raising the available credit. Withdraw (POST /business-credit/accounts/:id/withdraw, 409insufficient_fundsabove the balance) books the return on the ledger.GET /business-credit/accounts/:id/funds→{ fundsHeldMinor }. - Automatic settlement from funds. The settlements service subscribes to
invoice.issuedand applies held funds the moment an invoice is raised, so an order placed on account against funds ispaidimmediately (settlement.credit_applied+invoice.paidwithviaCredit). Funds count towards eligibility, so an account with a zero credit limit can trade prepaid only. - Top-up webhook. Checkout Sessions carrying
{ business_credit: '1', topup: '1', accountId, channelId, amountMinor }(client_reference_idBC-<id>-TOPUP) are recorded by the existing signed webhook as acardsettlement with no allocations, then applied to open invoices; the outcome carriestopUp: true. Replays of the samepayment_intentremain duplicates.parseBusinessCreditMetadatanow returnstopUp; newbuildTopUpSessionParams. - Storefront.
GET /business-credit/my/accountincludesfunds: { heldMinor, currencyCode }; newGET /business-credit/my/settlementslists the customer's payments, deposits and top-ups withfundsHeldMinor. - Admin UI. A Funds pane on the account detail: funds held, available and open balance, a card top-up link (premium-locked like pay links, copied to the clipboard), Record a deposit (method limited to real payment methods, amount, reference, date, note) and Withdraw funds (amount, note, confirmation). The Overview KPI is now Funds held; settlement rows with no invoice allocations are labelled Funds top-up / deposit.
- E2E coverage for deposits, settlement of a new on-account order from funds, the top-up webhook (with replay), withdrawals and the 409 refusal, the customer's settlement list, and a prepaid-only account (limit 0, funds 200.00: a 120.00 order is eligible and settles, 400.00 is not).
v0.1.0
Added
- Credit accounts. One account per customer per channel with a credit limit, net terms, grace days, purchase-order requirement, company / VAT details, billing email and an
accountRef(BC-000007). Statusespending,active,suspended,closed(closing needs zero exposure). Permanent and temporary limit changes (with expiry) recorded inbusiness_credit_limit_change; every state change written to thebusiness_credit_eventaudit log and, for the customer-facing ones, published as aBusinessCreditEventon Vendure'sEventBus. - Applications. Storefront applications (
POST /business-credit/my/apply, premium; per-channel on/off), admin-created applications, an approve / reject queue that creates or updates the account, customer withdrawal, and the received / approved / rejected emails. - Pay on Account. A
business-creditpayment handler (settles the order at once, raises the invoice, returns the invoice details inmetadata.public, records a credit note on refund) and abusiness-credit-eligibilitychecker (active account, enough available credit, no overdue hold, optional minimum order) whose reason strings surface as Vendure'seligibilityMessage/paymentErrorMessage. Purchase-order number from theaddPaymentToOrdermetadata or an Order custom field. - Invoices. Per-channel numbering (
INV-prefix + zero-padded sequence, contention-safe),dueAt = issued + terms, statusesopen/part_paid/paid/overdue/written_off/void, late fees, reminders-sent tracking, pay-link reference; admin listing with search and filters, customer listing scoped to their own account. - Settlements. Bank transfer, card, direct debit, cheque, cash, credit note and write-off; oldest-due-first or explicit allocation; unallocated money held as account credit and applied by the daily pass or on demand; settlement refunds (unallocated first, then proportional); invoice void, write-off and manual fees; a signed ledger (
charge,payment,credit_note,write_off,fee,adjustment,refund) whose sum is the account balance; idempotency onproviderRef. - Stripe pay links. Checkout Sessions over plain
fetch(no SDK) from the admin or the storefront, keyed by the channel's existing Vendure Stripe payment method; a raw-body, signature-verified webhook (POST /business-credit/stripe-webhook) forcheckout.session.completed/checkout.session.async_payment_succeededthat records the card settlement exactly once and answers 5xx on internal failure so Stripe retries. Per-channel secrets viaBUSINESS_CREDIT_STRIPE_WEBHOOK_SECRET_<CHANNELCODE>. - Statements. Opening balance, running lines, closing balance, debit / credit totals, open invoices and 1–30 / 31–60 / 61–90 / 90+ aging for any period, as JSON, HTML and text; admin and customer endpoints.
- Dunning. A daily pass (07:00 on the worker,
crons.dailyAt/crons.enabled, admin Run now) that expires temporary limits, marks invoices overdue after grace, sends reminders on a per-channel schedule relative to the due date (default-3, 0, 7, 14, 30; one email per invoice per run, earlier days caught up silently), charges a pro-rata monthly late fee in 30-day chunks after a fee grace period, auto-suspends accounts past a threshold, applies held credit and emails last month's statement on the statement day; a report withskippedcounts on the free tier. - Emails. Ten kinds with
{{var}}templates in a branded HTML shell; SMTP from thesmtpoption orSMTP_*env; preview and test-send from the settings tab; a test seam (MailerService.setSender) for hosts and the e2e suite. - CSV exports of invoices, settlements and an account ledger with running balance (premium).
- Admin dashboard at Sales → Business credit: Overview, Accounts (detail with availability, limit history, invoices, ledger, record settlement, statement, events), Applications, Invoices, Settlements, Settings, and the Licence & billing card (14-day evaluation, buy from the admin, billing portal, self-update).
- Storefront REST under
/business-credit/my: account and availability, apply / application / withdraw, invoices, pay links, statement, ledger. - Free tier: accounts, limits with audit trail, Pay-on-Account handler and checker, invoices, manual settlements and allocation, ledger, statements, dashboard. Premium: Stripe pay links, reminders and dunning emails, late fees, auto-suspend, statement emails, CSV exports, storefront applications.
- MariaDB end-to-end suite covering the whole flow (application → approval → order on account → over-limit refusal → bank-transfer settlement → temporary limit and expiry → overdue, reminder, late fee and auto-suspend → reactivation with overdue hold → Stripe webhook with duplicate delivery → refund as credit note → CSV exports → statement balancing to the ledger).
Ready to ship?
Install in five minutes, run the trial on real traffic, keep it if it earns its place.