# See how a customer pays

`GET https://api.fiscalisto.com/v1/customers/{id}/payment_behavior`

How many days they take to pay, what share arrives on time with their credit days, whether they pay slower than before, how they pay and when what they owe would arrive. From their credit invoices (PPD) of the last 12 months and their payment complements, like «Cómo paga» in the app. It doesn't apply to XAXX010101000 or XEXX010101000.

## Parameters

| Name | In | Required | Description |
| --- | --- | --- | --- |
| `id` | path | yes | The object's id. |

## With the TypeScript SDK

```ts
import { Fiscalisto } from "fiscalisto";

// La llave viene de FISCALISTO_API_KEY.
const fiscalisto = new Fiscalisto();

const customerPaymentBehavior = await fiscalisto.customers.paymentBehavior("id");
```

## With the Python SDK

```python
from fiscalisto import Fiscalisto

# La llave viene de FISCALISTO_API_KEY.
fiscalisto = Fiscalisto()

customer_payment_behavior = fiscalisto.customers.payment_behavior("id")
```

## With the PHP SDK

```php
<?php

use Fiscalisto\Fiscalisto;

// La llave viene de FISCALISTO_API_KEY.
$fiscalisto = new Fiscalisto();

$customerPaymentBehavior = $fiscalisto->customers->paymentBehavior('id');
```

## With the .NET SDK

```csharp
using Fiscalisto;

// La llave viene de FISCALISTO_API_KEY.
var fiscalisto = new FiscalistoClient();

var customerPaymentBehavior = await fiscalisto.Customers.PaymentBehaviorAsync("id");
```

## With the Go SDK

```go
package main

import (
	"context"
	"fmt"
	"log"

	fiscalisto "fiscalisto.com/go"
)

func main() {
	// La llave viene de FISCALISTO_API_KEY.
	client, err := fiscalisto.NewClient("")
	if err != nil {
		log.Fatal(err)
	}
	ctx := context.Background()

	customerPaymentBehavior, err := client.Customers.PaymentBehavior(ctx, "id")
	if err != nil {
		log.Fatal(err)
	}
	fmt.Printf("%+v\n", *customerPaymentBehavior)
}
```

## With the Java SDK

```java
import com.fiscalisto.FiscalistoClient;

// La llave viene de FISCALISTO_API_KEY.
var fiscalisto = new FiscalistoClient();

var customerPaymentBehavior = fiscalisto.customers().paymentBehavior("id");
System.out.println(customerPaymentBehavior);
```

## Response 200

OK.

A `CustomerPaymentBehavior` object:

| Field | Type | Always present | Description |
| --- | --- | --- | --- |
| `object` | `"customer_payment_behavior"` | yes | What kind of object it is («invoice», «customer»…). |
| `livemode` | boolean | yes | true in production (fk_live_ keys), false in test mode (fk_test_). Test objects aren't valid before the SAT. |
| `issuer` | string | yes | The issuer. |
| `customer` | string | yes | The customer (cus_…). |
| `tax_id` | string | yes | Their RFC. |
| `credit_days` | integer | yes | Their credit days: their own (Clientes, or their group's) or the empresa's (Ajustes › Cobranza automática). Lateness is measured against them. (from -9007199254740991 to 9007199254740991) |
| `rating` | `on_time`, `sometimes_late`, `late`, `very_late`, `no_history` | yes | on_time (80 % or more arrives on time and an average delay of 5 days or less), sometimes_late (up to 15 days), late (up to 45), very_late (more) or no_history (fewer than 2 paid invoices and nothing past due). |
| `paid_invoices` | integer | yes | PPD invoices with a payment in the last 12 months. (from -9007199254740991 to 9007199254740991) |
| `average_days_to_pay` | number or null | yes | Days from invoice to payment, amount-weighted average; null without payments. |
| `median_days_to_pay` | integer or null | yes | The typical invoice: half were paid in this many days or fewer. |
| `p75_days_to_pay` | integer or null | yes | 3 out of 4 invoices were paid in this many days or fewer. |
| `on_time_share` | number or null | yes | The share (0 to 1) of what was paid that arrived before its due date; unpaid past-due amounts count as late. |
| `average_days_late` | number or null | yes | Days after the due date, amount-weighted average; unpaid past-due amounts count with their days late up to today. |
| `trend` | object or null | yes | The last 3 months against the previous 9; null with fewer than 2 paid invoices on either side. |
| `trend.direction` | `slower`, `faster`, `steady` | yes | slower: takes 7 or more days longer than before; faster: 7 or more fewer. |
| `trend.recent_days` | number | yes | Average days to pay over the last 3 months. |
| `trend.earlier_days` | number | yes | Average days over the previous 9 months. |
| `overdue_amount` | number | yes | What they owe that is already past due, in pesos. |
| `overdue_invoices` | integer | yes | How many invoices they have past due. (from -9007199254740991 to 9007199254740991) |
| `payment_forms` | array of object | yes | How they paid, largest first. |
| `payment_forms[].payment_form` | string | yes | SAT payment form code (c_FormaPago): 03 transfer, 02 check… |
| `payment_forms[].amount` | number | yes | What was paid this way, in pesos. |
| `payment_forms[].share` | number | yes | Its share of what was paid (0 to 1). |
| `months` | array of object | yes | Each of the last 12 months, oldest first. |
| `months[].month` | string | yes | The payments' month (YYYY-MM). |
| `months[].average_days_to_pay` | number or null | yes | Average days (amount-weighted) of that month's payments; null without payments. |
| `months[].amount` | number | yes | What was paid that month, in pesos. |
| `months[].paid_invoices` | integer | yes | Invoices with a payment that month. (from -9007199254740991 to 9007199254740991) |
| `last_payment` | object or null | yes | Their last payment; null without payments in 12 months. |
| `last_payment.date` | string | yes | The day (YYYY-MM-DD). |
| `last_payment.amount` | number | yes | What was paid that day, in pesos. |
| `cash_invoices` | integer | yes | Cash invoices (PUE) from the last 12 months: they are paid when issued and don't count in the rest. (from -9007199254740991 to 9007199254740991) |
| `open_invoices` | array of object | yes | What they owe now, oldest invoice first. |
| `open_invoices[].uuid` | string | yes | The invoice's UUID (tax folio). |
| `open_invoices[].date` | string | yes | Its date (YYYY-MM-DD). |
| `open_invoices[].payment_method` | `PPD`, `PUE` | yes | PPD on credit; PUE being paid this month. |
| `open_invoices[].amount_due` | number | yes | What is left, in pesos. |
| `open_invoices[].due_date` | string | yes | When it is due: its date plus the credit days (a PUE, at the end of its month). |
| `open_invoices[].expected_payment_date` | string | yes | When it would arrive: its date plus how long the customer usually takes (without history, the due date). |

```json
{
  "object": "customer_payment_behavior",
  "livemode": false,
  "issuer": "iss_OufpKqnrvx9p",
  "customer": "cus_OufpKqnrvx9p1",
  "tax_id": "ICV060329BY0",
  "credit_days": 30,
  "rating": "late",
  "paid_invoices": 14,
  "average_days_to_pay": 47.5,
  "median_days_to_pay": 45,
  "p75_days_to_pay": 58,
  "on_time_share": 0.214,
  "average_days_late": 18.2,
  "trend": {
    "direction": "slower",
    "recent_days": 56,
    "earlier_days": 41.3
  },
  "overdue_amount": 17400,
  "overdue_invoices": 1,
  "payment_forms": [
    {
      "payment_form": "03",
      "amount": 162400,
      "share": 0.875
    },
    {
      "payment_form": "02",
      "amount": 23200,
      "share": 0.125
    }
  ],
  "months": [
    {
      "month": "2026-10",
      "average_days_to_pay": 56,
      "amount": 34800,
      "paid_invoices": 2
    }
  ],
  "last_payment": {
    "date": "2026-10-28",
    "amount": 17400
  },
  "cash_invoices": 3,
  "open_invoices": [
    {
      "uuid": "5FB2822E-396D-4725-8521-CDC4BDD20CCF",
      "date": "2026-09-01",
      "payment_method": "PPD",
      "amount_due": 17400,
      "due_date": "2026-10-01",
      "expected_payment_date": "2026-10-16"
    }
  ]
}
```

## Errors

- `customer_generic_tax_id` (400): Público en general (XAXX010101000) and foreign customers (XEXX010101000) share one RFC, so how one pays says nothing about the others: there's no payment behavior for them.
- `feature_not_in_plan` (403): Live, this part of the API (inventario, portal de proveedores, pedidos, comprobación de gastos) follows the empresa's plan, as in the app: it comes with Operaciones (added to any paid plan; included in Corporativo). The books (the /v1/accounting routes except DIOT, cross checks, IVA refunds and fixed assets) come with Contabilidad (added to Independiente, Emprendedor or Negocio; included in Despacho and Corporativo): without it, changing the books answers this error, and reading them works only up to the last month it had it. Add either in Ajustes › Plan y pagos; test mode has everything.
- `issuer_archived` (400): The issuer is archived and no longer stamps. Its documents can still be read and canceled.
- `issuer_linked_empresa` (403): That issuer is an empresa of the app connected to your account: through the API it only offers its Portal de proveedores (/v1/portal_suppliers and /v1/supplier_invoices) and, once someone who may pay suppliers and change Configurar pagos turned them on, its supplier payouts (/v1/payouts and /v1/payroll_payouts). It also stops when whoever connected it (or turned its payouts on) no longer has that permission in the empresa: message_es says which. Do everything else in the app.
- `issuer_missing` (404): There is no such issuer in the account (or it belongs to the other mode).
- `issuer_not_allowed` (403): This key can't use that issuer.
- `issuer_required` (400): The account has several issuers and the request doesn't say which: send `issuer` (iss_…).
- `livemode_mismatch` (400): The object belongs to the other mode: an fk_test_ key only sees test data and an fk_live_ key only live data.
- `resource_missing` (404): There's no object with that id (or it belongs to another issuer or the other mode).

Plus those of any call (key, fields, limits): https://fiscalisto.com/en/docs/api/errores.md.
