Introducing a new way to review your PRs.

Read the announcement

frappe / erpnext

Free and Open Source Enterprise Resource Planning (ERP)

View on GitHub

20 documents · Updated Nov 23, 2026

docs / point-of-sale-and-subscriptions

Point of sale and recurring billing

ERPNext connects immediate point-of-sale (POS) sales with planned recurring billing. POS work turns a customer purchase into a paid or partly paid sales transaction that can affect stock and finance. Subscription work turns a customer plan into dated invoices over time, with payment status controlling the subscription state. These flows sit under sales and commerce and connect to sales fulfillment, financial transaction posting, and accounting and finance.

Point-of-sale transactions

POS profiles

A POS Profile is the operating setup for a cashier and a company. It defines the items and customers that the cashier can use, the price and tax context, the warehouse, and the payment methods available at checkout. A profile can also set invoice and receipt behavior. Each payment method needs a company account, and each profile has one default method. erpnext/…/pos_profile.py and erpnext/…/pos_profile.json define this operating context.

The profile also connects a cashier to a sales process. Profile lookup respects the user's document permissions, user assignment, company, and disabled state. A user can have one default active profile for a company. The profile cannot be disabled while it has an open POS session. This keeps a cashier from starting work with an invalid company or payment setup.

References: erpnext/…/pos_profile.py• L80-121 erpnext/…/pos_profile.py• L123-168 erpnext/…/pos_profile.py• L204-231 erpnext/…/pos_profile.py• L309-351 erpnext/…/pos_profile.json• L134-177

POS sessions

A POS session is the controlled period in which a cashier uses a profile. The cashier opens the session with opening balances and a company, then closes it with the sales, taxes, and payment totals for that period. The opening entry prevents a second open session for the same profile and prevents a cashier from being assigned to another open POS.

The closing entry gathers submitted POS transactions for the matching cashier, profile, and time range. It checks that no session invoice is missing and then starts consolidation and payment reconciliation. Consolidation can run in a background process, so the closing entry can report Queued or Failed and offer a retry. A successful close gives finance a period-level view without losing the source invoices. A session may use a backdated posting date and time when the related sales are backdated, so the close records the intended business period instead of replacing it with the current time.

The session flow is summarized below.

flowchart LR
    Profile[POS Profile] --> Open[Open POS session]
    Open --> Sale[Create and submit POS sale]
    Sale --> Close[Create POS Closing Entry]
    Close --> Queue[Consolidate in background]
    Queue -->|Success| Reconcile[Reconcile payments and taxes]
    Queue -->|Failure| Retry[Retry closing]
    Reconcile --> Finance[Sales and finance records]

References: erpnext/…/pos_closing_entry.py• L62-90 erpnext/…/pos_closing_entry.py• L211-289 erpnext/…/pos_closing_entry.py• L308-325 erpnext/…/test_pos_closing_entry.py• L91-187 erpnext/…/test_pos_closing_entry.py• L784-953

POS invoices

A POS Invoice is the immediate sales document for checkout. It requires a customer and an included payment, and it carries the items, taxes, discounts, warehouse choice, payment rows, change, and outstanding amount needed to complete the sale. It supports returns through a link to the original POS invoice.

The POS Invoice record also links the sale to a profile and to an optional consolidated Sales Invoice. It keeps the subscription period fields used by the shared invoice model, while its POS payment fields cover paid amount, change, and payment methods. Its status can show a submitted, paid, partly paid, unpaid, consolidated, returned, or cancelled sale. Partial payment is available when the profile allows it. The DocType gives Sales Manager and Sales User roles select access without giving them the write and submit rights held by accounts roles.

The checkout screen uses the selected profile to limit customers and items to the cashier's operating context. It loads the profile's company and customer groups, then applies the profile's item, warehouse, pricing, tax, and payment choices to the sale. This keeps the screen's choices aligned with the profile that controls the session. POS invoices can use an explicit posting date and time for a backdated session when the posting-time option is enabled. The cashier can later collect an outstanding amount through the payment methods in the profile or request payment through an external payment flow.

Submitting the invoice updates the sales and finance records that belong to the transaction. Depending on the profile and invoice settings, the sale can update stock, apply loyalty activity, and later join a POS closing entry. The checkout view treats quantities from submitted, unconsolidated POS invoices as reserved stock, including stock used inside product bundles. It also subtracts normal warehouse reservations from the available quantity. An item that allows negative stock can still be blocked when warehouse stock is reserved. At submission, explicit serial or batch choices for item and packed rows are applied before automatic packed-row allocation. A POS Invoice is part of the wider Sales Invoice model, so its status and accounting effects follow the same sales and payment relationships.

The POS flow can collect an outstanding balance after submission. It accepts only payment methods allowed by the profile and resolves the cash or bank account for the invoice's company. A missing company account stops the collection. It can also create a return or request payment through an external payment request when the sale is not fully settled. A return based on an overpaid sale uses the sale total for its repayment and does not treat checkout change as an extra refund. These actions keep later payment activity attached to the original sale instead of creating a separate sales context.

References: erpnext/…/pos_invoice.py• L210-246 erpnext/…/pos_invoice.py• L247-280 erpnext/…/pos_invoice.py• L415-488 erpnext/…/pos_invoice.py• L639-697 erpnext/…/pos_invoice.py• L914-1013 erpnext/…/pos_invoice.py• L1057-1136 erpnext/…/pos_invoice.py• L1247-1258 erpnext/…/pos.py• L399-412 erpnext/…/pos_invoice.js• L44-67 erpnext/…/pos_invoice.js• L167-185 erpnext/…/pos_invoice.js• L227-357 erpnext/…/pos_invoice.js• L423-467 erpnext/…/test_pos_invoice.py• L434-570 erpnext/…/test_pos_invoice.py• L1317-1350

Recurring billing

Subscription plans

A Subscription Plan is a reusable offer for a billable item. It gives the item a currency, a billing interval, and a way to determine its rate. The supported interval units are day, week, month, and year. A plan can use a fixed rate, a price list, or a monthly rate that can be prorated for partial periods.

Plans are the pricing units of a subscription. A subscription can use more than one plan, but the plans must share the same billing cycle. This keeps one subscription period and one invoice schedule meaningful for all its items.

References: erpnext/…/subscription_plan.py• L37-42 erpnext/…/subscription_plan.py• L45-93 erpnext/…/subscription_plan.json• L33-115 erpnext/…/test_subscription_plan.py• L33-68 erpnext/…/subscription_plan_detail.json• L11-26

Subscription periods

A Subscription is a recurring billing agreement for a party. For a customer, it produces Sales Invoices. The same model can bill a supplier through Purchase Invoices. The record holds the party, company, plans, start and end dates, trial dates, tax choices, discount rules, due terms, and the next period to bill.

The subscription tracks both the current invoiced period and the next billing period. It can bill at the start of a period, at the end, or a set number of days before the start. A prepaid subscription can create its first invoice when it starts, while a trial or future-dated subscription waits for its billing date. It can follow calendar months when the plan uses a monthly cycle. The system can also prorate a partial period, which helps align service dates with the amount billed.

The subscription also presents billing history after the record exists. This gives sales and finance staff a view of past billing activity alongside the current and next periods.

References: erpnext/…/subscription.py• L109-151 erpnext/…/subscription.py• L153-222 erpnext/…/subscription.py• L224-275 erpnext/…/subscription.json• L57-167 erpnext/…/subscription.json• L240-298 erpnext/…/subscription.json• L304-316

Subscription invoices

Each billing cycle creates an invoice linked back to the subscription. The invoice carries the subscription period and the plan items. It uses the party and company billing context, applies the relevant tax template and discount, and can include a payment schedule. Service dates can flow to deferred revenue or deferred expense when the item supports that treatment.

For a customer subscription, the resulting Sales Invoice enters the normal sales and accounts-receivable flow. Its payment status is then used to assess the subscription. An unpaid invoice can move the subscription into a grace period and can block the next invoice unless the subscription allows billing while a prior invoice is unpaid.

References: erpnext/…/subscription.py• L451-588 erpnext/…/subscription.py• L590-648 erpnext/…/subscription.py• L773-814 erpnext/…/subscription.json• L306-316

Subscription processing

Recurring billing is driven by a dated processing step rather than by a cashier session. The daily maintenance schedule creates a Process Subscription record. On submit, that record selects all non-cancelled subscriptions, or one selected subscription, and sends the work to a long-running queue in batches.

For each subscription, processing checks whether the next invoice is due. It creates the invoice when the trigger date is reached, advances the next period, and updates the status. A newly created subscription catches up elapsed periods from its start date. When past-due billing is enabled, catch-up can create each elapsed period through the subscription end date without creating duplicate periods. The processor does not create a chain of overdue invoices when a prior invoice blocks billing unless the subscription explicitly permits it. A late processing run can bill only within one billing cycle after the period end. If one subscription fails during a processing pass, the pass continues to attempt the later subscriptions in the batch.

The recurring flow is summarized below.

flowchart TD
    Plan[Subscription Plan] --> Sub[Subscription for party]
    Sub --> Schedule[Next billing period]
    Schedule --> Process[Scheduled subscription processing]
    Process -->|Due and allowed| Invoice[Sales Invoice or Purchase Invoice]
    Process -->|Not due or blocked| Wait[Keep period and status]
    Invoice --> Payment[Payment or credit activity]
    Payment --> Status[Update subscription status]
    Status --> Schedule

References: erpnext/hooks.py• L497-523 erpnext/…/process_subscription.py• L11-43 erpnext/…/subscription.py• L122-151 erpnext/…/subscription.py• L650-709 erpnext/…/subscription.py• L711-734 erpnext/…/subscription.py• L1041-1054 erpnext/…/test_subscription.py• L722-771 erpnext/…/test_subscription.py• L913-977

Subscription statuses

The subscription status describes both service time and collection state. A trial can become active after its trial period. An overdue invoice can move the record to Grace Period, then to Unpaid or Cancelled according to the grace settings. An ended subscription can become Completed when its invoices are settled. A fully credited set of unpaid invoices can produce Refunded.

Payment or invoice updates refresh the subscription status without waiting for the next scheduled run. Cancellation remains final for that subscription, so paying an existing invoice does not reactivate it. A fully credited invoice set can show Refunded, but a partial credit does not produce that status.

Cancellation stops future invoice creation but does not change invoices that already exist. A period-end cancellation can therefore finish the current period before the subscription stops. Restarting a cancelled subscription starts a new billing period and does not preserve the prior invoice history as the active schedule.

References: erpnext/…/subscription.py• L277-361 erpnext/…/subscription.py• L773-814 erpnext/…/subscription.py• L816-851 erpnext/…/test_subscription.py• L773-905 erpnext/…/test_subscription.py• L979-1029 erpnext/…/subscription.json• L57-64 erpnext/…/subscription_settings.json• L13-32

Sales and finance relationships

Customer billing context

The Customer is the shared business record for POS and recurring sales. It supplies the identity used on invoices and can define the default currency, price list, payment terms, tax context, receivable accounts, credit limits, and sales ownership. A POS profile can narrow which customer groups are available, while a subscription validates its plans against the party or company billing currency.

This shared context matters because a checkout sale is immediate but a subscription invoice may be created later without a cashier. Both need a stable customer and company context so that prices, taxes, receivables, and later payments point to the same financial relationship.

References: erpnext/…/README.md• L1 erpnext/…/customer.json• L183-229 erpnext/…/customer.json• L271-331 erpnext/…/subscription.py• L380-408

Sales accounting

POS invoices and subscription sales invoices meet in the Sales Invoice accounting path. A submitted invoice can update the general ledger, payment ledger, stock ledger when stock is enabled, tax totals, and links to sales documents. Subscription plan dimensions can supply the accounting dimension for the generated invoice, with the item default as a fallback. POS adds payment-at-sale rules and session closing. Subscription adds service periods, scheduled creation, and collection-driven status.

The important boundary is the invoice. POS creates an invoice as part of a live sale. Subscription creates an invoice as part of a billing period. Finance can therefore report on both through invoice status, payment records, returns or credits, and the links back to the source sale or subscription.

References: erpnext/…/sales_invoice.py• L294-343 erpnext/…/sales_invoice.py• L419-485 erpnext/…/pos_invoice.py• L247-276 erpnext/…/pos_closing_entry.py• L236-280 erpnext/…/subscription.py• L571-588 erpnext/…/test_subscription.py• L1083-1122

Sales fulfillment boundary

POS can update stock for an immediate sale and can hold submitted, unconsolidated quantities out of the available POS stock view. Subscription billing is designed for service items and leaves stock updates untouched when it builds an invoice. This separates physical fulfillment from a recurring charge for a service. If a subscription includes a physical delivery need, that work belongs in the wider sales and fulfillment flow rather than in the recurring invoice schedule.

References: erpnext/…/pos_profile.py• L31-77 erpnext/…/pos_invoice.py• L415-488 erpnext/…/pos_invoice.py• L969-1013 erpnext/…/pos_invoice.py• L1057-1133 erpnext/…/subscription.py• L526-529 erpnext/…/subscription.py• L603-637

Change checklist

When these files or sections are changed, remember to consider these:

  • Changes to POS payment methods or later payment collection must preserve the company account and single-default-method rules in the profile and opening or closing session flow.
  • Changes to POS profile access or user assignments must preserve permission-filtered profile lookup and the one-default-profile rule for each user and company.
  • Changes to POS invoice type or closing behavior must keep the invoice references, cashier and profile checks, consolidation links, and payment reconciliation aligned.
  • Changes to POS closing background work must preserve the Queued and Failed states, realtime refresh, retry path, and opening-entry status updates.
  • Changes to POS session posting dates or invoice posting-time validation must preserve the ability to close a backdated session and keep the invoice and closing-entry periods aligned.
  • Changes to POS stock availability must preserve the POS Profile permission boundary, normal warehouse reservations, the reservation rules for submitted unconsolidated invoices and bundles, and the rule that reserved stock blocks negative-stock items.
  • Changes to POS submission order must preserve explicit serial or batch choices for item and packed rows before automatic packed-row allocation.
  • Changes to POS returns or payment mapping must preserve the source sale total and must not refund checkout change as sale value.
  • Changes to the POS checkout controller must preserve profile-based company, customer-group, item, warehouse, and payment defaults, along with the links used for returns and later payment collection.
  • Changes to POS Invoice permissions must preserve select access for sales roles without changing the write and submit boundary for accounts roles.
  • Changes to subscription plan intervals or rate rules must stay compatible with the subscription period calculation and the requirement for one billing cycle per subscription.
  • Changes to invoice creation must preserve the subscription link and period dates. These fields connect invoice status back to subscription state.
  • Changes to subscription status or due-date rules must be checked against scheduled processing, the one-cycle late-fire limit, and the setting that allows billing while a prior invoice is unpaid.
  • Changes to payment or invoice update hooks must preserve immediate status refresh and must not reactivate a cancelled subscription.
  • Changes to credit or refund status rules must distinguish a fully credited invoice set from a partially credited set.
  • Changes to catch-up billing or subscription end dates must preserve one invoice per period, the no-rebill boundary, and period-end cancellation or completion.
  • Changes to subscription plan dimensions must preserve plan-level precedence and the selling or buying item default for the party type.
  • Changes to customer currency, price, tax, or receivable defaults must be checked for both immediate POS use and later subscription invoice creation.

Important failure modes

TriggerConsequenceGuard
A POS Profile has no payment method, more than one default, or a method without a company account.The profile cannot be used for a valid checkout or session.Validate the profile payment table and each Mode of Payment account.
A user lacks permission for a matching POS Profile.The profile is not returned for selection, even when its company or user assignment matches.Grant the required profile access and keep user assignments aligned with permissions.
A cashier opens a second session for the profile or is already assigned to another open POS.The new opening entry is rejected and the session totals cannot be mixed.Keep one open profile session and one open cashier assignment.
A closing entry includes an unsubmitted invoice or an invoice from another profile or cashier.The session cannot close and its totals cannot be consolidated.Select only submitted invoices from the matching session context.
A session invoice is created after the closing entry gathers its invoices.Submit or retry fails because the closing entry does not include every invoice in the session.Create the closing entry again after the session is complete.
Background POS consolidation fails.The closing entry remains failed and linked invoices are not in the expected final state.Read the error, fix the cause, and use the retry action.
A backdated POS invoice or closing entry does not carry its intended posting date and time.The sale or close can be rejected as out of sequence or can be recorded in the wrong business period.Enable posting-time control and keep invoice and session dates within the opening period.
A POS user lacks access to the profile, company, or warehouse used for a stock check.The stock view rejects the request instead of exposing quantities outside the user's POS scope.Keep POS Profile access and company or warehouse permissions aligned with the cashier's work.
The selected POS Profile excludes the intended customer group or item.The checkout screen does not offer a valid customer or item for the sale.Keep profile customer groups and item eligibility aligned with the cashier's selling scope.
Submitted POS invoices remain open and unconsolidated while another checkout checks stock.The available POS quantity is reduced by the open invoice and its bundle components.Consolidate or cancel the source invoice when it no longer represents an active sale.
Warehouse stock is reserved for an item that allows negative stock.POS availability can still block the sale because reserved stock must remain available for its existing use.Release the reservation or keep enough free quantity for the new sale.
A sales user lacks select access to POS Invoice.Sales links cannot use the POS invoice as a selectable sales record.Keep select access for the intended sales roles while retaining accounts write and submit controls.
A return reuses the source payment total that includes checkout change.The return can refund more than the sale value.Base return payment rows on the source sale total and exclude change.
A payment method has no default cash or bank account for the invoice company.Later POS payment collection cannot create the payment row.Set the company-specific default account on the Mode of Payment.
Subscription plans use different billing intervals or currencies.The subscription has no single safe period or party billing currency.Use one billing cycle and match plan currency to the party or company currency.
A subscription has an outstanding invoice while past-due billing is disabled.The next scheduled invoice is not created.Resolve the invoice or enable billing past due when the business rule allows it.
A processing run starts more than one billing cycle after a period ends.The old period is not billed by that run.Run subscription processing on schedule or use a valid recovery action for the missed period.
A payment or invoice update reprocesses a cancelled subscription as active.A settled old invoice can incorrectly restart future billing.Keep cancellation state authoritative when status updates run.
One invoice in a multi-period subscription is credited and the status is treated as Refunded.The subscription can appear fully refunded while another invoice still has a balance.Require the full invoice set to be credited before using Refunded.
Catch-up billing advances beyond the subscription end or repeats an already billed period.The customer can receive an extra or invalid invoice.Bound catch-up by the end date and the next unbilled period.
A prior POS closing entry is still submitted when its invoice is cancelled.The invoice cancellation is blocked because the closing record owns the consolidated sale.Cancel the related POS closing entry first.

Key files

FileWhy to read it
erpnext/…/pos_profile.pyDefines the company, cashier, access, payment, price, tax, and warehouse context for POS work.
erpnext/…/pos_invoice.pyShows the POS-specific sales, payment, return, stock validation, posting-time, and stock availability boundary on top of the sales invoice flow.
erpnext/…/pos.pyProvides the shared company-specific account lookup used when POS payment rows are added.
erpnext/…/pos_invoice.jsShows how the checkout screen applies profile company, customer-group, item, and payment context, and supports returns, outstanding payment collection, loyalty, and payment requests.
erpnext/…/pos_invoice.jsonDefines the POS invoice record, its checkout fields, its links to consolidation and subscription periods, and its role-based selection boundary.
erpnext/…/pos_opening_entry.pyDefines how a cashier starts a controlled POS session.
erpnext/…/pos_closing_entry.pyDefines invoice selection, payment reconciliation, background consolidation, retry, backdated closing periods, and session closing.
erpnext/…/pos_closing_entry.jsShows the closing-entry refresh, failure message, and retry behavior.
erpnext/…/subscription_plan.pyDefines recurring item pricing and billing intervals.
erpnext/…/subscription.pyDefines billing periods, invoice creation, scheduled processing, late-run limits, and subscription status.
erpnext/…/subscription.jsonDefines the subscription's party, billing period, invoice timing, billing history, status, and links to generated sales or purchase invoices.
erpnext/…/process_subscription.pyConnects scheduled work to queued processing for active subscriptions.
erpnext/…/subscription_settings.jsonDefines the global grace-period and proration choices that change recurring billing outcomes.
erpnext/…/test_subscription.pyVerifies the subscription lifecycle, catch-up limits, payment-driven status changes, credit outcomes, period-end completion, and batch continuation after an error.
erpnext/…/sales_invoice.pyShows the shared sales, payment, stock, tax, and ledger path used by invoices.
erpnext/…/customer.jsonShows the customer billing context shared by POS and subscription sales.