# Invoicing recipes

> The most common invoices ready to copy: from your catalog, on credit (PPD), in dollars, with withholdings, global to the general public and in batch.

They all go to [`POST /v1/invoices`](https://fiscalisto.com/en/docs/api/referencia/facturas/create-invoice) with your key and a new `Idempotency-Key`. Only the body changes; what you don't send has its usual value (PUE, MXN, use G03 or S01 with regime 616, unit E48, or H87 when the SAT key is a good, tax object 02, IVA 16%, quantity 1).

## From your customer and product catalog

Save the customer and the product once, and invoice with their ids. The product sets its key, unit, price and taxes; you can change the quantity or the price on each line item.

```bash tab="cURL"
curl https://api.fiscalisto.com/v1/customers \
  -H "Authorization: Bearer $FISCALISTO_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{ "tax_id": "ICV060329BY0", "legal_name": "INMOBILIARIA CVA", "tax_system": "601", "zip": "33826", "email": "pagos@cva.example" }'
```

```ts tab="TypeScript"
import { Fiscalisto } from "fiscalisto";

// The key comes from FISCALISTO_API_KEY.
const fiscalisto = new Fiscalisto();

const customer = await fiscalisto.customers.create({
  tax_id: "ICV060329BY0",
  legal_name: "INMOBILIARIA CVA",
  tax_system: "601",
  zip: "33826",
  email: "pagos@cva.example",
});
```

```python tab="Python"
from fiscalisto import Fiscalisto

# The key comes from FISCALISTO_API_KEY.
fiscalisto = Fiscalisto()

customer = fiscalisto.customers.create({
    "tax_id": "ICV060329BY0",
    "legal_name": "INMOBILIARIA CVA",
    "tax_system": "601",
    "zip": "33826",
    "email": "pagos@cva.example",
})
```

```php tab="PHP"
<?php

use Fiscalisto\Fiscalisto;

// The key comes from FISCALISTO_API_KEY.
$fiscalisto = new Fiscalisto();

$customer = $fiscalisto->customers->create([
    'tax_id' => 'ICV060329BY0',
    'legal_name' => 'INMOBILIARIA CVA',
    'tax_system' => '601',
    'zip' => '33826',
    'email' => 'pagos@cva.example',
]);
```

```go tab="Go"
package main

import (
	"context"
	"fmt"
	"log"

	fiscalisto "fiscalisto.com/go"
)

func main() {
	// The key comes from FISCALISTO_API_KEY.
	client, err := fiscalisto.NewClient("")
	if err != nil {
		log.Fatal(err)
	}
	ctx := context.Background()

	customer, err := client.Customers.Create(ctx, &fiscalisto.CreateCustomerParams{
		TaxID:     "ICV060329BY0",
		LegalName: "INMOBILIARIA CVA",
		TaxSystem: "601",
		Zip:       "33826",
		Email:     fiscalisto.String("pagos@cva.example"),
	})
	if err != nil {
		log.Fatal(err)
	}
	fmt.Println(customer.ID)
}
```

```java tab="Java"
import com.fiscalisto.FiscalistoClient;
import com.fiscalisto.model.CreateCustomerParams;

// The key comes from FISCALISTO_API_KEY.
var fiscalisto = new FiscalistoClient();

var customer = fiscalisto.customers().create(new CreateCustomerParams()
        .setTaxId("ICV060329BY0")
        .setLegalName("INMOBILIARIA CVA")
        .setTaxSystem("601")
        .setZip("33826")
        .setEmail("pagos@cva.example"));
System.out.println(customer.getId());
```

```csharp tab="C#"
using Fiscalisto;

// The key comes from FISCALISTO_API_KEY.
var fiscalisto = new FiscalistoClient();

var customer = await fiscalisto.Customers.CreateAsync(new CreateCustomerParams
{
    TaxId = "ICV060329BY0",
    LegalName = "INMOBILIARIA CVA",
    TaxSystem = "601",
    Zip = "33826",
    Email = "pagos@cva.example",
});
```

```bash tab="cURL"
curl https://api.fiscalisto.com/v1/invoices \
  -H "Authorization: Bearer $FISCALISTO_API_KEY" \
  -H "Idempotency-Key: pedido-A-1043" \
  -H "Content-Type: application/json" \
  -d '{
    "customer": "cus_OufpKqnrvx9p1",
    "payment_form": "04",
    "items": [{ "product": "prd_OufpKqnrvx9p1", "quantity": 3 }],
    "send_email": true
  }'
```

```ts tab="TypeScript"
import { Fiscalisto } from "fiscalisto";

// The key comes from FISCALISTO_API_KEY.
const fiscalisto = new Fiscalisto();

const invoice = await fiscalisto.invoices.create({
  customer: "cus_OufpKqnrvx9p1",
  payment_form: "04",
  items: [
    {
      product: "prd_OufpKqnrvx9p1",
      quantity: 3,
    },
  ],
  send_email: true,
}, { idempotencyKey: "pedido-A-1043" });
```

```python tab="Python"
from fiscalisto import Fiscalisto

# The key comes from FISCALISTO_API_KEY.
fiscalisto = Fiscalisto()

invoice = fiscalisto.invoices.create({
    "customer": "cus_OufpKqnrvx9p1",
    "payment_form": "04",
    "items": [
        {
            "product": "prd_OufpKqnrvx9p1",
            "quantity": 3,
        },
    ],
    "send_email": True,
}, idempotency_key="pedido-A-1043")
```

```php tab="PHP"
<?php

use Fiscalisto\Fiscalisto;

// The key comes from FISCALISTO_API_KEY.
$fiscalisto = new Fiscalisto();

$invoice = $fiscalisto->invoices->create([
    'customer' => 'cus_OufpKqnrvx9p1',
    'payment_form' => '04',
    'items' => [
        [
            'product' => 'prd_OufpKqnrvx9p1',
            'quantity' => 3,
        ],
    ],
    'send_email' => true,
], ['idempotency_key' => 'pedido-A-1043']);
```

```go tab="Go"
package main

import (
	"context"
	"fmt"
	"log"

	fiscalisto "fiscalisto.com/go"
)

func main() {
	// The key comes from FISCALISTO_API_KEY.
	client, err := fiscalisto.NewClient("")
	if err != nil {
		log.Fatal(err)
	}
	ctx := context.Background()

	invoice, err := client.Invoices.Create(ctx, &fiscalisto.InvoiceCreate{
		Customer:    fiscalisto.IDOf[fiscalisto.InvoiceCreateCustomer]("cus_OufpKqnrvx9p1"),
		PaymentForm: fiscalisto.String("04"),
		Items: []fiscalisto.InvoiceCreateItem{
			{
				Product:  fiscalisto.String("prd_OufpKqnrvx9p1"),
				Quantity: fiscalisto.Float64(3),
			},
		},
		SendEmail: fiscalisto.Bool(true),
	}, fiscalisto.WithIdempotencyKey("pedido-A-1043"))
	if err != nil {
		log.Fatal(err)
	}
	fmt.Println(invoice.ID)
}
```

```java tab="Java"
import com.fiscalisto.FiscalistoClient;
import com.fiscalisto.RequestOptions;
import com.fiscalisto.model.InvoiceCreate;
import com.fiscalisto.model.InvoiceCreateItem;
import java.util.List;

// The key comes from FISCALISTO_API_KEY.
var fiscalisto = new FiscalistoClient();

var invoice = fiscalisto.invoices().create(new InvoiceCreate()
        .setCustomer("cus_OufpKqnrvx9p1")
        .setPaymentForm("04")
        .setItems(List.of(
                new InvoiceCreateItem()
                        .setProduct("prd_OufpKqnrvx9p1")
                        .setQuantity(3)
        ))
        .setSendEmail(true), RequestOptions.idempotencyKey("pedido-A-1043"));
System.out.println(invoice.getId());
```

```csharp tab="C#"
using Fiscalisto;

// The key comes from FISCALISTO_API_KEY.
var fiscalisto = new FiscalistoClient();

var invoice = await fiscalisto.Invoices.CreateAsync(new InvoiceCreate
{
    Customer = "cus_OufpKqnrvx9p1",
    PaymentForm = "04",
    Items = new()
    {
        new()
        {
            Product = "prd_OufpKqnrvx9p1",
            Quantity = 3,
        },
    },
    SendEmail = true,
}, new RequestOptions { IdempotencyKey = "pedido-A-1043" });
```

With `send_email` the customer gets the PDF and the XML at the email on their record (or `customer.email`); without either it returns `400` `parameter_missing`, so an invoice that reaches nobody isn't stamped. A new customer can also go in full in `customer`, as in the [quickstart](https://fiscalisto.com/en/docs/api); it isn't saved to the catalog.

### By email

Each email carries the PDF and the XML, goes out in the issuer's name and replies reach the issuer. To send it again, or to another address, use `POST /v1/invoices/{id}/send` with `to` (and `cc` if you want); without `to` it goes to the invoice's email. The `send_email` email goes out once even when stamping takes a while: if the invoice answered `202` (`processing`) or the email service didn't answer, it's sent by itself in the following minutes, to the same addresses.

```bash tab="cURL"
curl https://api.fiscalisto.com/v1/invoices/inv_OufpKqnrvx9p9Gl0bAlQ2mZr8sKdLx/send \
  -H "Authorization: Bearer $FISCALISTO_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{ "to": "pagos@cliente.mx" }'
```

```ts tab="TypeScript"
import { Fiscalisto } from "fiscalisto";

// The key comes from FISCALISTO_API_KEY.
const fiscalisto = new Fiscalisto();

const invoice = await fiscalisto.invoices.send("inv_OufpKqnrvx9p9Gl0bAlQ2mZr8sKdLx", { to: "pagos@cliente.mx" });
```

```python tab="Python"
from fiscalisto import Fiscalisto

# The key comes from FISCALISTO_API_KEY.
fiscalisto = Fiscalisto()

invoice = fiscalisto.invoices.send("inv_OufpKqnrvx9p9Gl0bAlQ2mZr8sKdLx", {"to": "pagos@cliente.mx"})
```

```php tab="PHP"
<?php

use Fiscalisto\Fiscalisto;

// The key comes from FISCALISTO_API_KEY.
$fiscalisto = new Fiscalisto();

$invoice = $fiscalisto->invoices->send('inv_OufpKqnrvx9p9Gl0bAlQ2mZr8sKdLx', ['to' => 'pagos@cliente.mx']);
```

```go tab="Go"
package main

import (
	"context"
	"fmt"
	"log"

	fiscalisto "fiscalisto.com/go"
)

func main() {
	// The key comes from FISCALISTO_API_KEY.
	client, err := fiscalisto.NewClient("")
	if err != nil {
		log.Fatal(err)
	}
	ctx := context.Background()

	invoice, err := client.Invoices.Send(ctx, "inv_OufpKqnrvx9p9Gl0bAlQ2mZr8sKdLx", &fiscalisto.SendInvoiceParams{
		To: fiscalisto.String("pagos@cliente.mx"),
	})
	if err != nil {
		log.Fatal(err)
	}
	fmt.Println(invoice.ID)
}
```

```java tab="Java"
import com.fiscalisto.FiscalistoClient;
import com.fiscalisto.model.SendInvoiceParams;

// The key comes from FISCALISTO_API_KEY.
var fiscalisto = new FiscalistoClient();

var invoice = fiscalisto.invoices().send("inv_OufpKqnrvx9p9Gl0bAlQ2mZr8sKdLx", new SendInvoiceParams().setTo("pagos@cliente.mx"));
System.out.println(invoice.getId());
```

```csharp tab="C#"
using Fiscalisto;

// The key comes from FISCALISTO_API_KEY.
var fiscalisto = new FiscalistoClient();

var invoice = await fiscalisto.Invoices.SendAsync("inv_OufpKqnrvx9p9Gl0bAlQ2mZr8sKdLx", new SendInvoiceParams { To = "pagos@cliente.mx" });
```

The invoice says in `email` what happened to its last send: `status` is `sent`, `delivered`, `opened`, `bounced` or `complained` (the customer marked it as spam), and `recipients` says it per address, with a bounce's reason in `bounce_reason` («mailbox doesn't exist», «mailbox full»…). When it bounces or is marked as spam, [`invoice.email_bounced`](https://fiscalisto.com/en/docs/api/referencia/eventos/invoice-email-bounced) or [`invoice.email_complained`](https://fiscalisto.com/en/docs/api/referencia/eventos/invoice-email-complained) arrives.

Before sending, we check each address at no cost: that the domain exists and receives mail, that it isn't a disposable address, that it isn't misspelled (`@gmial.com`) and that it hasn't bounced permanently in the last 90 days, from any account. If one fails, it returns `400` `email_failed` with the reason and nothing is sent; the invoice does stay stamped.

Each address (including those in `cc`) gets its own message, with the **Darse de baja** (unsubscribe) link at the bottom and the `List-Unsubscribe` and `List-Unsubscribe-Post` headers (RFC 8058), so Gmail and the others show their unsubscribe button. Whoever unsubscribes stops getting that issuer's emails (not other issuers'): that address is skipped on sends and, if none is left, it returns `400` `email_failed` and says so. Only that person can resubscribe, from the same link. To keep emails reaching the inbox, an invoice is sent at most 10 times a day, and resends to addresses that are neither the customer's nor the issuer's have a daily cap that grows with your account (see [Limits](https://fiscalisto.com/en/docs/api/limites#emails)).

## PPD (paid in installments or later)

If the customer pays you later or in parts, the invoice goes with method PPD and payment form 99 (to be defined), which Fiscalisto sets on its own. Each payment is recorded afterwards with a [payment complement](https://fiscalisto.com/en/docs/api/pagos-y-notas-de-credito).

```bash tab="cURL"
curl https://api.fiscalisto.com/v1/invoices \
  -H "Authorization: Bearer $FISCALISTO_API_KEY" \
  -H "Idempotency-Key: contrato-88-oct" \
  -H "Content-Type: application/json" \
  -d '{
    "customer": { "tax_id": "ICV060329BY0", "legal_name": "INMOBILIARIA CVA", "tax_system": "601", "zip": "33826" },
    "payment_method": "PPD",
    "items": [{ "description": "Implementación del sistema", "product_key": "81111500", "unit_price": 45000 }]
  }'
```

```ts tab="TypeScript"
import { Fiscalisto } from "fiscalisto";

// The key comes from FISCALISTO_API_KEY.
const fiscalisto = new Fiscalisto();

const invoice = await fiscalisto.invoices.create({
  customer: {
    tax_id: "ICV060329BY0",
    legal_name: "INMOBILIARIA CVA",
    tax_system: "601",
    zip: "33826",
  },
  payment_method: "PPD",
  items: [
    {
      description: "Implementación del sistema",
      product_key: "81111500",
      unit_price: 45000,
    },
  ],
}, { idempotencyKey: "contrato-88-oct" });
```

```python tab="Python"
from fiscalisto import Fiscalisto

# The key comes from FISCALISTO_API_KEY.
fiscalisto = Fiscalisto()

invoice = fiscalisto.invoices.create({
    "customer": {
        "tax_id": "ICV060329BY0",
        "legal_name": "INMOBILIARIA CVA",
        "tax_system": "601",
        "zip": "33826",
    },
    "payment_method": "PPD",
    "items": [
        {
            "description": "Implementación del sistema",
            "product_key": "81111500",
            "unit_price": 45000,
        },
    ],
}, idempotency_key="contrato-88-oct")
```

```php tab="PHP"
<?php

use Fiscalisto\Fiscalisto;

// The key comes from FISCALISTO_API_KEY.
$fiscalisto = new Fiscalisto();

$invoice = $fiscalisto->invoices->create([
    'customer' => [
        'tax_id' => 'ICV060329BY0',
        'legal_name' => 'INMOBILIARIA CVA',
        'tax_system' => '601',
        'zip' => '33826',
    ],
    'payment_method' => 'PPD',
    'items' => [
        [
            'description' => 'Implementación del sistema',
            'product_key' => '81111500',
            'unit_price' => 45000,
        ],
    ],
], ['idempotency_key' => 'contrato-88-oct']);
```

```go tab="Go"
package main

import (
	"context"
	"fmt"
	"log"

	fiscalisto "fiscalisto.com/go"
)

func main() {
	// The key comes from FISCALISTO_API_KEY.
	client, err := fiscalisto.NewClient("")
	if err != nil {
		log.Fatal(err)
	}
	ctx := context.Background()

	invoice, err := client.Invoices.Create(ctx, &fiscalisto.InvoiceCreate{
		Customer: fiscalisto.ObjectOf(fiscalisto.InvoiceCreateCustomer{
			TaxID:     "ICV060329BY0",
			LegalName: "INMOBILIARIA CVA",
			TaxSystem: "601",
			Zip:       "33826",
		}),
		PaymentMethod: fiscalisto.String("PPD"),
		Items: []fiscalisto.InvoiceCreateItem{
			{
				Description: fiscalisto.String("Implementación del sistema"),
				ProductKey:  fiscalisto.String("81111500"),
				UnitPrice:   fiscalisto.Float64(45000),
			},
		},
	}, fiscalisto.WithIdempotencyKey("contrato-88-oct"))
	if err != nil {
		log.Fatal(err)
	}
	fmt.Println(invoice.ID)
}
```

```java tab="Java"
import com.fiscalisto.FiscalistoClient;
import com.fiscalisto.RequestOptions;
import com.fiscalisto.model.InvoiceCreate;
import com.fiscalisto.model.InvoiceCreateCustomer;
import com.fiscalisto.model.InvoiceCreateItem;
import java.util.List;

// The key comes from FISCALISTO_API_KEY.
var fiscalisto = new FiscalistoClient();

var invoice = fiscalisto.invoices().create(new InvoiceCreate()
        .setCustomer(new InvoiceCreateCustomer()
                .setTaxId("ICV060329BY0")
                .setLegalName("INMOBILIARIA CVA")
                .setTaxSystem("601")
                .setZip("33826"))
        .setPaymentMethod("PPD")
        .setItems(List.of(
                new InvoiceCreateItem()
                        .setDescription("Implementación del sistema")
                        .setProductKey("81111500")
                        .setUnitPrice(45000)
        )), RequestOptions.idempotencyKey("contrato-88-oct"));
System.out.println(invoice.getId());
```

```csharp tab="C#"
using Fiscalisto;

// The key comes from FISCALISTO_API_KEY.
var fiscalisto = new FiscalistoClient();

var invoice = await fiscalisto.Invoices.CreateAsync(new InvoiceCreate
{
    Customer = new InvoiceCreateCustomer
    {
        TaxId = "ICV060329BY0",
        LegalName = "INMOBILIARIA CVA",
        TaxSystem = "601",
        Zip = "33826",
    },
    PaymentMethod = "PPD",
    Items = new()
    {
        new()
        {
            Description = "Implementación del sistema",
            ProductKey = "81111500",
            UnitPrice = 45000,
        },
    },
}, new RequestOptions { IdempotencyKey = "contrato-88-oct" });
```

## In dollars

Send the currency and the day's exchange rate (the one the DOF publishes the previous business day). Prices go in dollars.

```bash tab="cURL"
curl https://api.fiscalisto.com/v1/invoices \
  -H "Authorization: Bearer $FISCALISTO_API_KEY" \
  -H "Idempotency-Key: pedido-USD-17" \
  -H "Content-Type: application/json" \
  -d '{
    "customer": { "tax_id": "ICV060329BY0", "legal_name": "INMOBILIARIA CVA", "tax_system": "601", "zip": "33826" },
    "payment_form": "03",
    "currency": "USD",
    "exchange_rate": 18.35,
    "items": [{ "description": "Licencia anual", "product_key": "43232400", "unit_price": 1200 }]
  }'
```

```ts tab="TypeScript"
import { Fiscalisto } from "fiscalisto";

// The key comes from FISCALISTO_API_KEY.
const fiscalisto = new Fiscalisto();

const invoice = await fiscalisto.invoices.create({
  customer: {
    tax_id: "ICV060329BY0",
    legal_name: "INMOBILIARIA CVA",
    tax_system: "601",
    zip: "33826",
  },
  payment_form: "03",
  currency: "USD",
  exchange_rate: 18.35,
  items: [
    {
      description: "Licencia anual",
      product_key: "43232400",
      unit_price: 1200,
    },
  ],
}, { idempotencyKey: "pedido-USD-17" });
```

```python tab="Python"
from fiscalisto import Fiscalisto

# The key comes from FISCALISTO_API_KEY.
fiscalisto = Fiscalisto()

invoice = fiscalisto.invoices.create({
    "customer": {
        "tax_id": "ICV060329BY0",
        "legal_name": "INMOBILIARIA CVA",
        "tax_system": "601",
        "zip": "33826",
    },
    "payment_form": "03",
    "currency": "USD",
    "exchange_rate": 18.35,
    "items": [
        {
            "description": "Licencia anual",
            "product_key": "43232400",
            "unit_price": 1200,
        },
    ],
}, idempotency_key="pedido-USD-17")
```

```php tab="PHP"
<?php

use Fiscalisto\Fiscalisto;

// The key comes from FISCALISTO_API_KEY.
$fiscalisto = new Fiscalisto();

$invoice = $fiscalisto->invoices->create([
    'customer' => [
        'tax_id' => 'ICV060329BY0',
        'legal_name' => 'INMOBILIARIA CVA',
        'tax_system' => '601',
        'zip' => '33826',
    ],
    'payment_form' => '03',
    'currency' => 'USD',
    'exchange_rate' => 18.35,
    'items' => [
        [
            'description' => 'Licencia anual',
            'product_key' => '43232400',
            'unit_price' => 1200,
        ],
    ],
], ['idempotency_key' => 'pedido-USD-17']);
```

```go tab="Go"
package main

import (
	"context"
	"fmt"
	"log"

	fiscalisto "fiscalisto.com/go"
)

func main() {
	// The key comes from FISCALISTO_API_KEY.
	client, err := fiscalisto.NewClient("")
	if err != nil {
		log.Fatal(err)
	}
	ctx := context.Background()

	invoice, err := client.Invoices.Create(ctx, &fiscalisto.InvoiceCreate{
		Customer: fiscalisto.ObjectOf(fiscalisto.InvoiceCreateCustomer{
			TaxID:     "ICV060329BY0",
			LegalName: "INMOBILIARIA CVA",
			TaxSystem: "601",
			Zip:       "33826",
		}),
		PaymentForm:  fiscalisto.String("03"),
		Currency:     fiscalisto.String("USD"),
		ExchangeRate: fiscalisto.Float64(18.35),
		Items: []fiscalisto.InvoiceCreateItem{
			{
				Description: fiscalisto.String("Licencia anual"),
				ProductKey:  fiscalisto.String("43232400"),
				UnitPrice:   fiscalisto.Float64(1200),
			},
		},
	}, fiscalisto.WithIdempotencyKey("pedido-USD-17"))
	if err != nil {
		log.Fatal(err)
	}
	fmt.Println(invoice.ID)
}
```

```java tab="Java"
import com.fiscalisto.FiscalistoClient;
import com.fiscalisto.RequestOptions;
import com.fiscalisto.model.InvoiceCreate;
import com.fiscalisto.model.InvoiceCreateCustomer;
import com.fiscalisto.model.InvoiceCreateItem;
import java.util.List;

// The key comes from FISCALISTO_API_KEY.
var fiscalisto = new FiscalistoClient();

var invoice = fiscalisto.invoices().create(new InvoiceCreate()
        .setCustomer(new InvoiceCreateCustomer()
                .setTaxId("ICV060329BY0")
                .setLegalName("INMOBILIARIA CVA")
                .setTaxSystem("601")
                .setZip("33826"))
        .setPaymentForm("03")
        .setCurrency("USD")
        .setExchangeRate(18.35)
        .setItems(List.of(
                new InvoiceCreateItem()
                        .setDescription("Licencia anual")
                        .setProductKey("43232400")
                        .setUnitPrice(1200)
        )), RequestOptions.idempotencyKey("pedido-USD-17"));
System.out.println(invoice.getId());
```

```csharp tab="C#"
using Fiscalisto;

// The key comes from FISCALISTO_API_KEY.
var fiscalisto = new FiscalistoClient();

var invoice = await fiscalisto.Invoices.CreateAsync(new InvoiceCreate
{
    Customer = new InvoiceCreateCustomer
    {
        TaxId = "ICV060329BY0",
        LegalName = "INMOBILIARIA CVA",
        TaxSystem = "601",
        Zip = "33826",
    },
    PaymentForm = "03",
    Currency = "USD",
    ExchangeRate = 18.35m,
    Items = new()
    {
        new()
        {
            Description = "Licencia anual",
            ProductKey = "43232400",
            UnitPrice = 1200,
        },
    },
}, new RequestOptions { IdempotencyKey = "pedido-USD-17" });
```

## With withholdings

Withholdings go per line item, as a rate. For example, freight to a company carries a 4% IVA withholding:

```bash tab="cURL"
curl https://api.fiscalisto.com/v1/invoices \
  -H "Authorization: Bearer $FISCALISTO_API_KEY" \
  -H "Idempotency-Key: flete-5521" \
  -H "Content-Type: application/json" \
  -d '{
    "customer": { "tax_id": "ICV060329BY0", "legal_name": "INMOBILIARIA CVA", "tax_system": "601", "zip": "33826" },
    "payment_form": "03",
    "items": [{ "description": "Flete Monterrey–Saltillo", "product_key": "78101800", "unit_price": 8000, "iva_retention": 0.04 }]
  }'
```

```ts tab="TypeScript"
import { Fiscalisto } from "fiscalisto";

// The key comes from FISCALISTO_API_KEY.
const fiscalisto = new Fiscalisto();

const invoice = await fiscalisto.invoices.create({
  customer: {
    tax_id: "ICV060329BY0",
    legal_name: "INMOBILIARIA CVA",
    tax_system: "601",
    zip: "33826",
  },
  payment_form: "03",
  items: [
    {
      description: "Flete Monterrey–Saltillo",
      product_key: "78101800",
      unit_price: 8000,
      iva_retention: 0.04,
    },
  ],
}, { idempotencyKey: "flete-5521" });
```

```python tab="Python"
from fiscalisto import Fiscalisto

# The key comes from FISCALISTO_API_KEY.
fiscalisto = Fiscalisto()

invoice = fiscalisto.invoices.create({
    "customer": {
        "tax_id": "ICV060329BY0",
        "legal_name": "INMOBILIARIA CVA",
        "tax_system": "601",
        "zip": "33826",
    },
    "payment_form": "03",
    "items": [
        {
            "description": "Flete Monterrey–Saltillo",
            "product_key": "78101800",
            "unit_price": 8000,
            "iva_retention": 0.04,
        },
    ],
}, idempotency_key="flete-5521")
```

```php tab="PHP"
<?php

use Fiscalisto\Fiscalisto;

// The key comes from FISCALISTO_API_KEY.
$fiscalisto = new Fiscalisto();

$invoice = $fiscalisto->invoices->create([
    'customer' => [
        'tax_id' => 'ICV060329BY0',
        'legal_name' => 'INMOBILIARIA CVA',
        'tax_system' => '601',
        'zip' => '33826',
    ],
    'payment_form' => '03',
    'items' => [
        [
            'description' => 'Flete Monterrey–Saltillo',
            'product_key' => '78101800',
            'unit_price' => 8000,
            'iva_retention' => 0.04,
        ],
    ],
], ['idempotency_key' => 'flete-5521']);
```

```go tab="Go"
package main

import (
	"context"
	"fmt"
	"log"

	fiscalisto "fiscalisto.com/go"
)

func main() {
	// The key comes from FISCALISTO_API_KEY.
	client, err := fiscalisto.NewClient("")
	if err != nil {
		log.Fatal(err)
	}
	ctx := context.Background()

	invoice, err := client.Invoices.Create(ctx, &fiscalisto.InvoiceCreate{
		Customer: fiscalisto.ObjectOf(fiscalisto.InvoiceCreateCustomer{
			TaxID:     "ICV060329BY0",
			LegalName: "INMOBILIARIA CVA",
			TaxSystem: "601",
			Zip:       "33826",
		}),
		PaymentForm: fiscalisto.String("03"),
		Items: []fiscalisto.InvoiceCreateItem{
			{
				Description:  fiscalisto.String("Flete Monterrey–Saltillo"),
				ProductKey:   fiscalisto.String("78101800"),
				UnitPrice:    fiscalisto.Float64(8000),
				IVARetention: fiscalisto.Float64(0.04),
			},
		},
	}, fiscalisto.WithIdempotencyKey("flete-5521"))
	if err != nil {
		log.Fatal(err)
	}
	fmt.Println(invoice.ID)
}
```

```java tab="Java"
import com.fiscalisto.FiscalistoClient;
import com.fiscalisto.RequestOptions;
import com.fiscalisto.model.InvoiceCreate;
import com.fiscalisto.model.InvoiceCreateCustomer;
import com.fiscalisto.model.InvoiceCreateItem;
import java.util.List;

// The key comes from FISCALISTO_API_KEY.
var fiscalisto = new FiscalistoClient();

var invoice = fiscalisto.invoices().create(new InvoiceCreate()
        .setCustomer(new InvoiceCreateCustomer()
                .setTaxId("ICV060329BY0")
                .setLegalName("INMOBILIARIA CVA")
                .setTaxSystem("601")
                .setZip("33826"))
        .setPaymentForm("03")
        .setItems(List.of(
                new InvoiceCreateItem()
                        .setDescription("Flete Monterrey–Saltillo")
                        .setProductKey("78101800")
                        .setUnitPrice(8000)
                        .setIvaRetention(0.04)
        )), RequestOptions.idempotencyKey("flete-5521"));
System.out.println(invoice.getId());
```

```csharp tab="C#"
using Fiscalisto;

// The key comes from FISCALISTO_API_KEY.
var fiscalisto = new FiscalistoClient();

var invoice = await fiscalisto.Invoices.CreateAsync(new InvoiceCreate
{
    Customer = new InvoiceCreateCustomer
    {
        TaxId = "ICV060329BY0",
        LegalName = "INMOBILIARIA CVA",
        TaxSystem = "601",
        Zip = "33826",
    },
    PaymentForm = "03",
    Items = new()
    {
        new()
        {
            Description = "Flete Monterrey–Saltillo",
            ProductKey = "78101800",
            UnitPrice = 8000,
            IvaRetention = 0.04m,
        },
    },
}, new RequestOptions { IdempotencyKey = "flete-5521" });
```

The response carries what was withheld in `taxes.iva_withheld` and `taxes.isr_withheld`, and the `total` already net of them. Other common ones: professional fees or rent from an individual to a company (`isr_retention: 0.10`, `iva_retention: 0.106667`) and RESICO to a company (`isr_retention: 0.0125`). Fiscalisto doesn't add withholdings on its own: it stamps the ones you send. If the issuer is an individual billing a company and a line item lacks the one its tax regime calls for (or carries professional-fee withholdings on a sale of goods), the response says so in `warnings`, as the [preview](#check-it-without-stamping) does. Only a company withholds (article 1o.-A, section II, of the IVA law and articles 106, 113-J and 116 of the ISR law): for an individual customer, the general public or a foreigner, the invoice is stamped without the withholdings you send, and `warnings` says that too.

## Global to the general public

What you sold with a receipt to whoever didn't ask for an invoice goes in a global invoice per day, week, month or two months. The customer is the general public: RFC `XAXX010101000`, name `PUBLICO EN GENERAL`, regime `616` and, as postal code, the issuer's (in test mode, SAT's test issuer's: `42501`). Each line item is a sale, with the receipt number in `sku`.

In the global invoice, each line item is stamped with the description `Venta`, the key `01010101`, the unit `ACT`, without `Unidad`, and quantity `1` with the sale's amount as price, even if you send others: that's what SAT's filling guide for the global CFDI asks (Anexo 20). `year` is the invoice date's year or up to five years earlier (SAT's error matrix, rule CFDI40136). To describe what was sold, invoice the person instead: RFC `XAXX010101000` with their name (not `PUBLICO EN GENERAL`, which is only valid on the global), regime `616` and the issuer's postal code; there the description is free.

### Donees and associations: keep the line items

If the issuer is a non-profit company (`tax_system` `603`), send `"keep_concepts": true` in `global` and each line item is stamped with its own `description`, `product_key`, `unit_key`, `unit_name` and `quantity`. It's what SAT's material on donees' CFDI shows: the recovery fee carries the service's key, the unit `M4` and a description saying it's a recovery fee, and a global's donation states its purpose. The receiver is still `PUBLICO EN GENERAL` with the global information, and each fee can go on its own line item with its folio or id in `sku` (NoIdentificacion):

```json
"global": { "periodicity": "04", "months": "11", "year": 2026, "keep_concepts": true },
"items": [
  {
    "description": "Cuota de recuperación ciclo escolar 2026-2027, CR-MM-000754",
    "product_key": "93141514",
    "unit_key": "M4",
    "unit_name": "Servicio",
    "sku": "CR-MM-000754",
    "unit_price": 200,
    "taxability": "02",
    "iva": "exento"
  }
]
```

With another regime, `keep_concepts` is refused with `invoice_invalid`.

```bash tab="cURL"
curl https://api.fiscalisto.com/v1/invoices \
  -H "Authorization: Bearer $FISCALISTO_API_KEY" \
  -H "Idempotency-Key: global-2026-10" \
  -H "Content-Type: application/json" \
  -d '{
    "customer": { "tax_id": "XAXX010101000", "legal_name": "PUBLICO EN GENERAL", "tax_system": "616", "zip": "42501" },
    "global": { "periodicity": "04", "months": "10", "year": 2026 },
    "payment_form": "01",
    "items": [
      { "description": "Venta", "product_key": "01010101", "unit_key": "ACT", "sku": "T-1001", "unit_price": 431.03 },
      { "description": "Venta", "product_key": "01010101", "unit_key": "ACT", "sku": "T-1002", "unit_price": 862.07 }
    ]
  }'
```

```ts tab="TypeScript"
import { Fiscalisto } from "fiscalisto";

// The key comes from FISCALISTO_API_KEY.
const fiscalisto = new Fiscalisto();

const invoice = await fiscalisto.invoices.create({
  customer: {
    tax_id: "XAXX010101000",
    legal_name: "PUBLICO EN GENERAL",
    tax_system: "616",
    zip: "42501",
  },
  global: {
    periodicity: "04",
    months: "10",
    year: 2026,
  },
  payment_form: "01",
  items: [
    {
      description: "Venta",
      product_key: "01010101",
      unit_key: "ACT",
      sku: "T-1001",
      unit_price: 431.03,
    },
    {
      description: "Venta",
      product_key: "01010101",
      unit_key: "ACT",
      sku: "T-1002",
      unit_price: 862.07,
    },
  ],
}, { idempotencyKey: "global-2026-10" });
```

```python tab="Python"
from fiscalisto import Fiscalisto

# The key comes from FISCALISTO_API_KEY.
fiscalisto = Fiscalisto()

invoice = fiscalisto.invoices.create({
    "customer": {
        "tax_id": "XAXX010101000",
        "legal_name": "PUBLICO EN GENERAL",
        "tax_system": "616",
        "zip": "42501",
    },
    "global": {
        "periodicity": "04",
        "months": "10",
        "year": 2026,
    },
    "payment_form": "01",
    "items": [
        {
            "description": "Venta",
            "product_key": "01010101",
            "unit_key": "ACT",
            "sku": "T-1001",
            "unit_price": 431.03,
        },
        {
            "description": "Venta",
            "product_key": "01010101",
            "unit_key": "ACT",
            "sku": "T-1002",
            "unit_price": 862.07,
        },
    ],
}, idempotency_key="global-2026-10")
```

```php tab="PHP"
<?php

use Fiscalisto\Fiscalisto;

// The key comes from FISCALISTO_API_KEY.
$fiscalisto = new Fiscalisto();

$invoice = $fiscalisto->invoices->create([
    'customer' => [
        'tax_id' => 'XAXX010101000',
        'legal_name' => 'PUBLICO EN GENERAL',
        'tax_system' => '616',
        'zip' => '42501',
    ],
    'global' => [
        'periodicity' => '04',
        'months' => '10',
        'year' => 2026,
    ],
    'payment_form' => '01',
    'items' => [
        [
            'description' => 'Venta',
            'product_key' => '01010101',
            'unit_key' => 'ACT',
            'sku' => 'T-1001',
            'unit_price' => 431.03,
        ],
        [
            'description' => 'Venta',
            'product_key' => '01010101',
            'unit_key' => 'ACT',
            'sku' => 'T-1002',
            'unit_price' => 862.07,
        ],
    ],
], ['idempotency_key' => 'global-2026-10']);
```

```go tab="Go"
package main

import (
	"context"
	"fmt"
	"log"

	fiscalisto "fiscalisto.com/go"
)

func main() {
	// The key comes from FISCALISTO_API_KEY.
	client, err := fiscalisto.NewClient("")
	if err != nil {
		log.Fatal(err)
	}
	ctx := context.Background()

	invoice, err := client.Invoices.Create(ctx, &fiscalisto.InvoiceCreate{
		Customer: fiscalisto.ObjectOf(fiscalisto.InvoiceCreateCustomer{
			TaxID:     "XAXX010101000",
			LegalName: "PUBLICO EN GENERAL",
			TaxSystem: "616",
			Zip:       "42501",
		}),
		Global: &fiscalisto.InvoiceCreateGlobal{
			Periodicity: "04",
			Months:      "10",
			Year:        2026,
		},
		PaymentForm: fiscalisto.String("01"),
		Items: []fiscalisto.InvoiceCreateItem{
			{
				Description: fiscalisto.String("Venta"),
				ProductKey:  fiscalisto.String("01010101"),
				UnitKey:     fiscalisto.String("ACT"),
				SKU:         fiscalisto.String("T-1001"),
				UnitPrice:   fiscalisto.Float64(431.03),
			},
			{
				Description: fiscalisto.String("Venta"),
				ProductKey:  fiscalisto.String("01010101"),
				UnitKey:     fiscalisto.String("ACT"),
				SKU:         fiscalisto.String("T-1002"),
				UnitPrice:   fiscalisto.Float64(862.07),
			},
		},
	}, fiscalisto.WithIdempotencyKey("global-2026-10"))
	if err != nil {
		log.Fatal(err)
	}
	fmt.Println(invoice.ID)
}
```

```java tab="Java"
import com.fiscalisto.FiscalistoClient;
import com.fiscalisto.RequestOptions;
import com.fiscalisto.model.InvoiceCreate;
import com.fiscalisto.model.InvoiceCreateCustomer;
import com.fiscalisto.model.InvoiceCreateGlobal;
import com.fiscalisto.model.InvoiceCreateItem;
import java.util.List;

// The key comes from FISCALISTO_API_KEY.
var fiscalisto = new FiscalistoClient();

var invoice = fiscalisto.invoices().create(new InvoiceCreate()
        .setCustomer(new InvoiceCreateCustomer()
                .setTaxId("XAXX010101000")
                .setLegalName("PUBLICO EN GENERAL")
                .setTaxSystem("616")
                .setZip("42501"))
        .setGlobal(new InvoiceCreateGlobal()
                .setPeriodicity("04")
                .setMonths("10")
                .setYear(2026))
        .setPaymentForm("01")
        .setItems(List.of(
                new InvoiceCreateItem()
                        .setDescription("Venta")
                        .setProductKey("01010101")
                        .setUnitKey("ACT")
                        .setSku("T-1001")
                        .setUnitPrice(431.03),
                new InvoiceCreateItem()
                        .setDescription("Venta")
                        .setProductKey("01010101")
                        .setUnitKey("ACT")
                        .setSku("T-1002")
                        .setUnitPrice(862.07)
        )), RequestOptions.idempotencyKey("global-2026-10"));
System.out.println(invoice.getId());
```

```csharp tab="C#"
using Fiscalisto;

// The key comes from FISCALISTO_API_KEY.
var fiscalisto = new FiscalistoClient();

var invoice = await fiscalisto.Invoices.CreateAsync(new InvoiceCreate
{
    Customer = new InvoiceCreateCustomer
    {
        TaxId = "XAXX010101000",
        LegalName = "PUBLICO EN GENERAL",
        TaxSystem = "616",
        Zip = "42501",
    },
    Global = new() { Periodicity = "04", Months = "10", Year = 2026 },
    PaymentForm = "01",
    Items = new()
    {
        new()
        {
            Description = "Venta",
            ProductKey = "01010101",
            UnitKey = "ACT",
            Sku = "T-1001",
            UnitPrice = 431.03m,
        },
        new()
        {
            Description = "Venta",
            ProductKey = "01010101",
            UnitKey = "ACT",
            Sku = "T-1002",
            UnitPrice = 862.07m,
        },
    },
}, new RequestOptions { IdempotencyKey = "global-2026-10" });
```

## Check it without stamping

With the same body, [`POST /v1/invoices/preview`](https://fiscalisto.com/en/docs/api/referencia/facturas/preview-invoice) runs every check stamping runs, without stamping or using a timbre, and needs no `Idempotency-Key`. Use it to show the total before charging, or to validate in your system before sending the invoice.

```bash tab="cURL"
curl https://api.fiscalisto.com/v1/invoices/preview \
  -H "Authorization: Bearer $FISCALISTO_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{ "customer": { "tax_id": "ICV060329BY0", "legal_name": "INMOBILIARIA CVA", "tax_system": "601", "zip": "33826" }, "payment_form": "03", "items": [{ "description": "Mensualidad", "product_key": "86121700", "unit_price": 2500, "quantity": 2 }] }'
```

```ts tab="TypeScript"
import { Fiscalisto } from "fiscalisto";

// The key comes from FISCALISTO_API_KEY.
const fiscalisto = new Fiscalisto();

const invoicePreview = await fiscalisto.invoices.preview({
  customer: {
    tax_id: "ICV060329BY0",
    legal_name: "INMOBILIARIA CVA",
    tax_system: "601",
    zip: "33826",
  },
  payment_form: "03",
  items: [
    {
      description: "Mensualidad",
      product_key: "86121700",
      unit_price: 2500,
      quantity: 2,
    },
  ],
});
```

```python tab="Python"
from fiscalisto import Fiscalisto

# The key comes from FISCALISTO_API_KEY.
fiscalisto = Fiscalisto()

invoice_preview = fiscalisto.invoices.preview({
    "customer": {
        "tax_id": "ICV060329BY0",
        "legal_name": "INMOBILIARIA CVA",
        "tax_system": "601",
        "zip": "33826",
    },
    "payment_form": "03",
    "items": [
        {
            "description": "Mensualidad",
            "product_key": "86121700",
            "unit_price": 2500,
            "quantity": 2,
        },
    ],
})
```

```php tab="PHP"
<?php

use Fiscalisto\Fiscalisto;

// The key comes from FISCALISTO_API_KEY.
$fiscalisto = new Fiscalisto();

$invoicePreview = $fiscalisto->invoices->preview([
    'customer' => [
        'tax_id' => 'ICV060329BY0',
        'legal_name' => 'INMOBILIARIA CVA',
        'tax_system' => '601',
        'zip' => '33826',
    ],
    'payment_form' => '03',
    'items' => [
        [
            'description' => 'Mensualidad',
            'product_key' => '86121700',
            'unit_price' => 2500,
            'quantity' => 2,
        ],
    ],
]);
```

```go tab="Go"
package main

import (
	"context"
	"fmt"
	"log"

	fiscalisto "fiscalisto.com/go"
)

func main() {
	// The key comes from FISCALISTO_API_KEY.
	client, err := fiscalisto.NewClient("")
	if err != nil {
		log.Fatal(err)
	}
	ctx := context.Background()

	invoicePreview, err := client.Invoices.Preview(ctx, &fiscalisto.InvoiceCreate{
		Customer: fiscalisto.ObjectOf(fiscalisto.InvoiceCreateCustomer{
			TaxID:     "ICV060329BY0",
			LegalName: "INMOBILIARIA CVA",
			TaxSystem: "601",
			Zip:       "33826",
		}),
		PaymentForm: fiscalisto.String("03"),
		Items: []fiscalisto.InvoiceCreateItem{
			{
				Description: fiscalisto.String("Mensualidad"),
				ProductKey:  fiscalisto.String("86121700"),
				UnitPrice:   fiscalisto.Float64(2500),
				Quantity:    fiscalisto.Float64(2),
			},
		},
	})
	if err != nil {
		log.Fatal(err)
	}
	fmt.Printf("%+v\n", *invoicePreview)
}
```

```java tab="Java"
import com.fiscalisto.FiscalistoClient;
import com.fiscalisto.model.InvoiceCreate;
import com.fiscalisto.model.InvoiceCreateCustomer;
import com.fiscalisto.model.InvoiceCreateItem;
import java.util.List;

// The key comes from FISCALISTO_API_KEY.
var fiscalisto = new FiscalistoClient();

var invoicePreview = fiscalisto.invoices().preview(new InvoiceCreate()
        .setCustomer(new InvoiceCreateCustomer()
                .setTaxId("ICV060329BY0")
                .setLegalName("INMOBILIARIA CVA")
                .setTaxSystem("601")
                .setZip("33826"))
        .setPaymentForm("03")
        .setItems(List.of(
                new InvoiceCreateItem()
                        .setDescription("Mensualidad")
                        .setProductKey("86121700")
                        .setUnitPrice(2500)
                        .setQuantity(2)
        )));
System.out.println(invoicePreview);
```

```csharp tab="C#"
using Fiscalisto;

// The key comes from FISCALISTO_API_KEY.
var fiscalisto = new FiscalistoClient();

var invoicePreview = await fiscalisto.Invoices.PreviewAsync(new InvoiceCreate
{
    Customer = new InvoiceCreateCustomer
    {
        TaxId = "ICV060329BY0",
        LegalName = "INMOBILIARIA CVA",
        TaxSystem = "601",
        Zip = "33826",
    },
    PaymentForm = "03",
    Items = new()
    {
        new()
        {
            Description = "Mensualidad",
            ProductKey = "86121700",
            UnitPrice = 2500,
            Quantity = 2,
        },
    },
});
```

It answers the invoice as it would be stamped now: the subtotal, taxes (`taxes`) and total Fiscalisto computes, the next folio, the warnings in `warnings` (a customer on SAT's lists, an invoice that looks like a duplicate, a withholding the issuer's tax regime calls for, a lease without its cuenta predial) and the unsigned XML in `unsigned_xml`. If something fails, it answers the same `invoice_invalid` as stamping. It works with a [read-only key](https://fiscalisto.com/en/docs/api/autenticacion#read-only-keys).

## Without waiting for the PAC

If the PAC is slow or the SAT doesn't answer, the invoice isn't lost: it answers `202` with the invoice in `status: "processing"` (already with its folio, without a `uuid`), Fiscalisto retries it on its own every few minutes, and [`invoice.stamped`](https://fiscalisto.com/en/docs/api/referencia/eventos/invoice-stamped) tells you when it's stamped (or [`invoice.failed`](https://fiscalisto.com/en/docs/api/referencia/eventos/invoice-failed) if the SAT rejects it). Don't send it again: repeating the request with the same `Idempotency-Key` answers the same invoice, never a second one.

To never wait for the PAC (a checkout, a queue on your server), send `"async": true`: it answers `202` as soon as the invoice is saved with its folio and stamps it after answering. Everything else is the same: the same checks (a data error answers `400` or `422` right away), the same warnings in `warnings` (checked before stamping), the same timbre and the same webhooks.

```bash tab="cURL"
curl https://api.fiscalisto.com/v1/invoices \
  -H "Authorization: Bearer $FISCALISTO_API_KEY" \
  -H "Idempotency-Key: pedido-2026-0042" \
  -H "Content-Type: application/json" \
  -d '{ "async": true, "customer": { "tax_id": "ICV060329BY0", "legal_name": "INMOBILIARIA CVA", "tax_system": "601", "zip": "33826" }, "payment_form": "03", "items": [{ "description": "Mensualidad", "product_key": "86121700", "unit_price": 2500 }] }'
```

```ts tab="TypeScript"
import { Fiscalisto } from "fiscalisto";

// The key comes from FISCALISTO_API_KEY.
const fiscalisto = new Fiscalisto();

const invoice = await fiscalisto.invoices.create({
  async: true,
  customer: {
    tax_id: "ICV060329BY0",
    legal_name: "INMOBILIARIA CVA",
    tax_system: "601",
    zip: "33826",
  },
  payment_form: "03",
  items: [
    {
      description: "Mensualidad",
      product_key: "86121700",
      unit_price: 2500,
    },
  ],
}, { idempotencyKey: "pedido-2026-0042" });
```

```python tab="Python"
from fiscalisto import Fiscalisto

# The key comes from FISCALISTO_API_KEY.
fiscalisto = Fiscalisto()

invoice = fiscalisto.invoices.create({
    "async": True,
    "customer": {
        "tax_id": "ICV060329BY0",
        "legal_name": "INMOBILIARIA CVA",
        "tax_system": "601",
        "zip": "33826",
    },
    "payment_form": "03",
    "items": [
        {
            "description": "Mensualidad",
            "product_key": "86121700",
            "unit_price": 2500,
        },
    ],
}, idempotency_key="pedido-2026-0042")
```

```php tab="PHP"
<?php

use Fiscalisto\Fiscalisto;

// The key comes from FISCALISTO_API_KEY.
$fiscalisto = new Fiscalisto();

$invoice = $fiscalisto->invoices->create([
    'async' => true,
    'customer' => [
        'tax_id' => 'ICV060329BY0',
        'legal_name' => 'INMOBILIARIA CVA',
        'tax_system' => '601',
        'zip' => '33826',
    ],
    'payment_form' => '03',
    'items' => [
        [
            'description' => 'Mensualidad',
            'product_key' => '86121700',
            'unit_price' => 2500,
        ],
    ],
], ['idempotency_key' => 'pedido-2026-0042']);
```

```go tab="Go"
package main

import (
	"context"
	"fmt"
	"log"

	fiscalisto "fiscalisto.com/go"
)

func main() {
	// The key comes from FISCALISTO_API_KEY.
	client, err := fiscalisto.NewClient("")
	if err != nil {
		log.Fatal(err)
	}
	ctx := context.Background()

	invoice, err := client.Invoices.Create(ctx, &fiscalisto.InvoiceCreate{
		Async: fiscalisto.Bool(true),
		Customer: fiscalisto.ObjectOf(fiscalisto.InvoiceCreateCustomer{
			TaxID:     "ICV060329BY0",
			LegalName: "INMOBILIARIA CVA",
			TaxSystem: "601",
			Zip:       "33826",
		}),
		PaymentForm: fiscalisto.String("03"),
		Items: []fiscalisto.InvoiceCreateItem{
			{
				Description: fiscalisto.String("Mensualidad"),
				ProductKey:  fiscalisto.String("86121700"),
				UnitPrice:   fiscalisto.Float64(2500),
			},
		},
	}, fiscalisto.WithIdempotencyKey("pedido-2026-0042"))
	if err != nil {
		log.Fatal(err)
	}
	fmt.Println(invoice.ID)
}
```

```java tab="Java"
import com.fiscalisto.FiscalistoClient;
import com.fiscalisto.RequestOptions;
import com.fiscalisto.model.InvoiceCreate;
import com.fiscalisto.model.InvoiceCreateCustomer;
import com.fiscalisto.model.InvoiceCreateItem;
import java.util.List;

// The key comes from FISCALISTO_API_KEY.
var fiscalisto = new FiscalistoClient();

var invoice = fiscalisto.invoices().create(new InvoiceCreate()
        .setAsync(true)
        .setCustomer(new InvoiceCreateCustomer()
                .setTaxId("ICV060329BY0")
                .setLegalName("INMOBILIARIA CVA")
                .setTaxSystem("601")
                .setZip("33826"))
        .setPaymentForm("03")
        .setItems(List.of(
                new InvoiceCreateItem()
                        .setDescription("Mensualidad")
                        .setProductKey("86121700")
                        .setUnitPrice(2500)
        )), RequestOptions.idempotencyKey("pedido-2026-0042"));
System.out.println(invoice.getId());
```

```csharp tab="C#"
using Fiscalisto;

// The key comes from FISCALISTO_API_KEY.
var fiscalisto = new FiscalistoClient();

var invoice = await fiscalisto.Invoices.CreateAsync(new InvoiceCreate
{
    Async = true,
    Customer = new InvoiceCreateCustomer
    {
        TaxId = "ICV060329BY0",
        LegalName = "INMOBILIARIA CVA",
        TaxSystem = "601",
        Zip = "33826",
    },
    PaymentForm = "03",
    Items = new()
    {
        new()
        {
            Description = "Mensualidad",
            ProductKey = "86121700",
            UnitPrice = 2500,
        },
    },
}, new RequestOptions { IdempotencyKey = "pedido-2026-0042" });
```

Check how it's going with [`GET /v1/invoices/{id}`](https://fiscalisto.com/en/docs/api/referencia/facturas/get-invoice) or wait for the webhook.

## Change the PDF's note

`notes` is the note for the customer printed on the PDF (up to 1,000 characters); it isn't in the XML. That's why it can be changed or removed after stamping, with [`POST /v1/invoices/{id}`](https://fiscalisto.com/en/docs/api/referencia/facturas/update-invoice): the invoice before SAT doesn't change, and the next PDF (`GET /v1/invoices/{id}/pdf` and the email) already carries the new one. `null` removes it. If you already sent it, your customer has the earlier PDF: send them the new one with [`POST /v1/invoices/{id}/send`](https://fiscalisto.com/en/docs/api/referencia/facturas/send-invoice).

```bash tab="cURL"
curl https://api.fiscalisto.com/v1/invoices/inv_OufpKqnrvx9p0Nfbydl9jG4UNGeTYcvdrg \
  -H "Authorization: Bearer $FISCALISTO_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{ "notes": "Orden de compra 4512" }'
```

```ts tab="TypeScript"
import { Fiscalisto } from "fiscalisto";

// The key comes from FISCALISTO_API_KEY.
const fiscalisto = new Fiscalisto();

const invoice = await fiscalisto.invoices.update("inv_OufpKqnrvx9p0Nfbydl9jG4UNGeTYcvdrg", { notes: "Orden de compra 4512" });
```

```python tab="Python"
from fiscalisto import Fiscalisto

# The key comes from FISCALISTO_API_KEY.
fiscalisto = Fiscalisto()

invoice = fiscalisto.invoices.update("inv_OufpKqnrvx9p0Nfbydl9jG4UNGeTYcvdrg", {"notes": "Orden de compra 4512"})
```

```php tab="PHP"
<?php

use Fiscalisto\Fiscalisto;

// The key comes from FISCALISTO_API_KEY.
$fiscalisto = new Fiscalisto();

$invoice = $fiscalisto->invoices->update('inv_OufpKqnrvx9p0Nfbydl9jG4UNGeTYcvdrg', ['notes' => 'Orden de compra 4512']);
```

```go tab="Go"
package main

import (
	"context"
	"fmt"
	"log"

	fiscalisto "fiscalisto.com/go"
)

func main() {
	// The key comes from FISCALISTO_API_KEY.
	client, err := fiscalisto.NewClient("")
	if err != nil {
		log.Fatal(err)
	}
	ctx := context.Background()

	invoice, err := client.Invoices.Update(ctx, "inv_OufpKqnrvx9p0Nfbydl9jG4UNGeTYcvdrg", &fiscalisto.UpdateInvoiceParams{
		Notes: fiscalisto.String("Orden de compra 4512"),
	})
	if err != nil {
		log.Fatal(err)
	}
	fmt.Println(invoice.ID)
}
```

```java tab="Java"
import com.fiscalisto.FiscalistoClient;
import com.fiscalisto.model.UpdateInvoiceParams;

// The key comes from FISCALISTO_API_KEY.
var fiscalisto = new FiscalistoClient();

var invoice = fiscalisto.invoices().update("inv_OufpKqnrvx9p0Nfbydl9jG4UNGeTYcvdrg", new UpdateInvoiceParams().setNotes("Orden de compra 4512"));
System.out.println(invoice.getId());
```

```csharp tab="C#"
using Fiscalisto;

// The key comes from FISCALISTO_API_KEY.
var fiscalisto = new FiscalistoClient();

var invoice = await fiscalisto.Invoices.UpdateAsync("inv_OufpKqnrvx9p0Nfbydl9jG4UNGeTYcvdrg", new UpdateInvoiceParams { Notes = "Orden de compra 4512" });
```

It returns the invoice with `notes`. Each change is kept in the invoice's **Historial** in Fiscalisto, with who made it and when. A payment complement carries no note (`parameter_invalid`), and an invoice not stamped yet returns `invoice_not_stamped`.

## Many at once

For hundreds or thousands of invoices (the month's fees, a marketplace's invoicing), use a [batch](https://fiscalisto.com/en/docs/api/lotes): a single request with up to 1,000.

## Learn more

- Every field, with its name in SAT's XML and its catalog, is in the [`POST /v1/invoices` reference](https://fiscalisto.com/en/docs/api/referencia/facturas/create-invoice).
- Search product and unit keys with [`GET /v1/sat_catalogs/product_keys?q=…`](https://fiscalisto.com/en/docs/api/referencia/catalogos-del-sat/get-sat-catalog).
- [Complements](https://fiscalisto.com/en/docs/api/complementos): Carta Porte, foreign trade, educational institutions, local taxes and more.
