Skip to content
Portal

Limits and balances

At the reservation step, each authorization checks it fits within the account’s available balance and all the limits concerning it, then holds its amount. It is the busiest step under concurrency: several cards of one account or one company may pay at the same instant.

The cardholder’s ledger records each movement of their account, as signed single entries:

Movement Effect
Hold At authorization: the amount is held (it lowers the available, not the balance)
Release At reversal, expiry or presentment: the hold is given back
Debit At presentment: the final amount is debited
Credit Refund, dispute credit, incoming transfer

Available = booked balance − holds + authorized overdraft. An authorization above the available is declined (51). Holds (pre-authorizations) are reservations, not accounting movements.

Element Content
Type A code and a label from the bank’s catalogue, a measure (amount, count, or both), a suggested period
Period Per operation, rolling (day, 7 days, 30 days) or calendar (day, week, month)
Criteria Channel, country (France, EEA, outside EEA), MCC, operation type (purchase, withdrawal, contactless)
Level Product, card (exception), shared (cardholder, account, organisation)

An operation must pass all its limits: those of its card (or, failing that, of its product) and each shared limit the card belongs to. The first exceeded decides the decline: 61 (amount) or 65 (count).

For an authorization, the gateway reads the limits without a lock and keeps those whose criteria apply; then one call to the database:

  1. locks the counters kept, always in the same order (no deadlock);
  2. checks the available and each limit;
  3. holds the amount everywhere, or nowhere.

Reversals and presentments give back what is due to the same counters (a presentment below the authorization gives back the difference). The hourly counters of a very busy shared limit are split into sub-counters so as not to become a bottleneck.

A limit shared by a whole company may receive tens of authorizations per second. Each gateway then takes a slice of it under the lock, and consumes it in memory, without a lock:

Rule Effect
What a slice has not consumed yet counts as consumed for the others The limit is never exceeded
A slice is at most a quarter of what remains, and adapts to the pace Few locks in steady state
Near the maximum, no slice: the operation goes through the lock Decision exact to the unit
A slice lives 10 seconds, never past the end of a window; what is not consumed comes back on its own No loss, even if a gateway stops
  • API: balance (GET /accounts/{id}/balance), movements (/ledger), credit (/credit); the card’s and product’s limits in their objects.
  • Screens: product and card limits, shared limits and types (Règles → Plafonds), balance and movements on the cardholder page.
  • Rules: compte.available_balance and the history amounts are readable by the rules, for finer checks than the limits.