ERPNext logo ERPNext automation · runs daily

Record customer payments against ERPNext invoices

A bank statement arrives with ten deposits. For each one you open ERPNext, find the customer, pick the invoice it pays and enter the amount again as a Payment Entry.

Cotlet does it in your own ERPNext account with list_sales_invoices, create_payment_entry and submit_payment_entry, called by your AI agent, an n8n workflow or a script.

Hosted · nothing to install or maintain

Can ERPNext do this on its own?

ERPNext creates the Payment Entry for you from a submitted invoice with Create > Payment, one invoice at a time (checked 14 Oct 2026). The REST API can create a Payment Entry with its References too, but nothing in ERPNext reads a list of bank deposits and matches them to invoices. Matching is the part left to a person.

How you do it in ERPNext today

  1. Open the unpaid invoice from Accounting > Sales and Receivables > Sales Invoice, filtered on the customer, and read the outstanding amount.
  2. Use Create > Payment on the submitted invoice, or start a new Payment Entry and select Receive as the Payment Type.
  3. Set the Company, Posting Date, Mode of Payment and the Party, then check the Paid From and Paid To accounts.
  4. Enter the Paid Amount and the Reference No and Reference Date from the bank, then use Get Outstanding Invoices or add the invoice under References by hand.
  5. Review the allocation and any deductions, then Submit. Do it again for every deposit, and watch for a payment that is larger than the invoice.

How to record customer payments against ERPNext invoices

Prompt

These bank deposits arrived today: Northwind Studio 1,650.00 by wire, reference WIRE-88213. Find their open invoice, create a payment entry against it, and submit it after I say OK. List any deposit you cannot match.
  1. 01

    Find candidates by customer and amount

    For each deposit the agent runs list_sales_invoices for that customer with the Unpaid and Partly Paid statuses and compares outstanding amounts to the deposit. An exact match is a candidate; two invoices of the same amount are not guessed.

  2. 02

    Handle partial and combined payments

    A deposit that equals the sum of two open invoices is allocated to both, oldest due date first. A deposit larger than everything open is reported, because ERPNext would leave the remainder as an unallocated advance.

  3. 03

    Create the entry as a draft

    create_payment_entry saves a Receive entry with the Mode of Payment, the bank Reference No and Reference Date and the allocated invoices. A draft does not post to the General Ledger.

  4. 04

    Show allocation, then post

    The agent lists each draft with the invoice it clears and the remaining balance. submit_payment_entry then posts them one by one, and the invoice moves to Paid or Partly Paid.

  5. 05

    List what did not match

    A deposit with an unknown payer, no open invoice or two equal candidates is returned with the reason and the nearest invoices, so you can decide in a minute.

What you get back

Example data

Deposits read: 3
Posted 2:
- Northwind Studio 1,650.00 clears ACC-SINV-2026-00042 (Paid)
- Lumen Dental 200.00 on ACC-SINV-2026-00043, 295.00 still open (Partly Paid)
Not matched 1:
- 880.00 from "H and P LLC": nearest ACC-SINV-2026-00044, Harbor & Pine, 880.00

Other ways to ask

  • Every morning, match yesterday's deposits from this CSV and create the payment entries as drafts only.
  • Allocate this 3,000.00 payment from Kestrel Logistics to its oldest open invoices first.
  • Show me invoices that look paid in the bank file but are still Unpaid in ERPNext, and change nothing.
  • Record the payment in the right Mode of Payment: Wire Transfer for references starting WIRE, Cash for the rest.

What ERPNext allows, and what to know first

  • A Payment Entry has the Payment Type Receive, Pay or Internal Transfer, and a customer payment is Receive.
  • A draft Payment Entry does not post to the General Ledger; submitting it creates the ledger entries.
  • For Receive, the debit goes to Bank or Cash and the credit to the customer receivable.
  • If a payment is larger than the invoice, the remainder stays as an unallocated advance for later reconciliation.
  • An invoice shows Partly Paid while a balance remains and Paid when the outstanding balance reaches zero.

create_payment_entry and submit_payment_entry ask for your OK by default. To run it daily without you, switch confirmation off for those tools in your dashboard.

Sources: ERPNext Docs: Payment Entry · ERPNext Docs: Sales Invoice · Frappe Docs: REST API

Call create_payment_entry from a script

curl

curl -X POST https://cotlet.dev/api/v1/erpnext/payment-entries \
  -H "Authorization: Bearer $COTLET_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"party":"Northwind Studio","paid_amount":1650,"mode_of_payment":"Wire Transfer","posting_date":"2026-10-14","reference_no":"WIRE-88213","reference_date":"2026-10-13","invoices":["ACC-SINV-2026-00042"]}'

Example response

{
  "payment_entry": "ACC-PAY-2026-00021",
  "payment_type": "Receive",
  "party": "Northwind Studio",
  "status": "Draft",
  "docstatus": 0,
  "posting_date": "2026-10-14",
  "paid_amount": 1650,
  "mode_of_payment": "Wire Transfer",
  "reference_no": "WIRE-88213",
  "reference_date": "2026-10-13",
  "allocated_to": [
    {
      "invoice": "ACC-SINV-2026-00042",
      "allocated_amount": 1650
    }
  ],
  "unallocated_amount": 0
}

MCP: add https://cotlet.dev/mcp/v1 with the same key; the call is erpnext_write → create_payment_entry. Example data.

Schedule it in n8n, Make, Zapier or cron

ERPNext tools this automation uses

Cotlet ERPNext tools used to record customer payments against ERPNext invoices
Tool Parameters
list_sales_invoices status, customer, from_date, to_date, limit, cursor
create_payment_entry party, paid_amount, mode_of_payment, posting_date, reference_no, reference_date, invoices
submit_payment_entry payment_entry
All 13 ERPNext tools with descriptions

Frequently asked questions

Is it safe to connect ERPNext to Cotlet?

Yes. You sign in to ERPNext yourself, in your own Cloud Browser in the EU, and we never save your password. Your agents only get ERPNext once you enable it, every background request is listed, and the browser profile is stored encrypted with AES-256-GCM, the cipher 1Password uses for its vaults. The AI model never sees a login, posts and messages wait for your OK, and Disable for agents cuts access in one click. Independent scanners grade cotlet.dev A+ on Qualys SSL Labs, securityheaders.com and Mozilla Observatory; live results are on https://cotlet.dev/security.

Give your agent access to ERPNext.

Free 7-day trial with 2,000 credits, no card needed. Cotlet is independent and not affiliated with ERPNext.