Skip to main content

Documentation Index

Fetch the complete documentation index at: https://docs.laportenard.com/llms.txt

Use this file to discover all available pages before exploring further.

Credit payments allow customers with a configured credit limit to pay on credit. The system checks eligibility in real time and filters credit lines from the fiscal payment pipeline.

Prerequisites

  • Customer assigned to the order with creditLimit > 0 in Odoo
  • Order mode is not return (credit is unavailable for refunds)

Eligibility check

The credit button appears in the payment screen when:
  1. The order has a partnerId (customer assigned)
  2. The customer’s creditLimit is greater than zero
  3. The order mode is not return
When the user taps the credit button, the frontend calls the credit-check API to verify eligibility server-side before adding a credit payment line.

API endpoint

POST /pos-api/v1/customers/credit-check
Checks whether a customer is eligible for credit payment at the requested amount.

Request

{
  "partner_id": 42,
  "amount": 1500.00
}

Response

{
  "eligible": true,
  "credit_limit": 5000.00,
  "current_balance": 1200.00,
  "available_credit": 3800.00
}

Payment flow

1

Select customer

Assign a customer with credit limit to the order via the customer select button.
2

Open payment screen

The credit button appears alongside standard payment methods if the customer is eligible.
3

Tap credit

Calls /pos-api/v1/customers/credit-check to verify eligibility. If approved, a payment line is added with isCredit: true.
4

Complete payment

Credit lines can cover part or all of the balance. Mix with cash/card as needed.
5

Order submission

Credit lines are filtered out from statement_ids before sending to Odoo. Only non-credit payment lines create journal entries.

Implementation details

PaymentLine.isCredit

The PaymentLine type in types.ts includes an isCredit?: boolean flag. During order submission, lines with isCredit: true are excluded:
const cashPayments = payments.filter((line) => !line.isCredit);

Customer model

The Customer interface in domain/customers/models.ts includes creditLimit?: number, populated from the bootstrap partners array and customer API responses.

Source files

src/domain/customers/creditApi.ts       # Credit check API client
src/domain/customers/models.ts          # Customer model with creditLimit
src/features/sales/components/payment/
├── credit-payment.ts                   # Eligibility logic
└── types.ts                            # PaymentLine with isCredit flag
src/features/sales/screens/PaymentScreen.tsx  # Credit button rendering
src/features/sales/screens/CartScreen.tsx     # Credit line filtering on submit