# SDKs: TypeScript, Python, PHP, .NET, Go and Java

> Stamp from Node, Bun, Deno, Workers, Python, PHP, .NET, Go or Java with types for every field, safe retries and webhooks verified in one line.

The six SDKs are the same API with their language's names: they're generated from the same [OpenAPI](https://api.fiscalisto.com/v1/openapi.json) document, so they have every route and every field, with its description and the name it carries in SAT's XML. None has dependencies, except Jackson in Java.

| SDK | Runs on | Install |
| --- | --- | --- |
| TypeScript | Node 20 or newer, Bun, Deno, Cloudflare Workers | `npm install fiscalisto` |
| Python | Python 3.10 or newer | `pip install fiscalisto` |
| PHP | PHP 8.1 or newer, with `curl` and `json` | `composer require fiscalisto/fiscalisto` |
| .NET (C#) | .NET 8 or newer | `dotnet add package Fiscalisto` |
| Go | Go 1.23 or newer | `go get fiscalisto.com/go` |
| Java | Java 17 or newer (Kotlin too) | Maven `com.fiscalisto:fiscalisto` |

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

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

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

console.log(invoice.uuid, invoice.total);
```

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

fiscalisto = Fiscalisto()  # la llave viene de FISCALISTO_API_KEY

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

print(invoice["uuid"], invoice["total"])
```

```php tab="PHP"
<?php
use Fiscalisto\Fiscalisto;

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

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

echo $invoice['uuid'], ' ', $invoice['total'];
```

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

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

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 = "Mensualidad", ProductKey = "86121700", Quantity = 2, UnitPrice = 2500 } },
}, new RequestOptions { IdempotencyKey = "pedido-A-1042" });

Console.WriteLine($"{invoice.Uuid} {invoice.Total}");
```

```go tab="Go"
import fiscalisto "fiscalisto.com/go"

client, err := fiscalisto.NewClient("") // la llave viene de FISCALISTO_API_KEY

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("Mensualidad"),
		ProductKey:  fiscalisto.String("86121700"),
		Quantity:    fiscalisto.Float64(2),
		UnitPrice:   fiscalisto.Float64(2500),
	}},
}, fiscalisto.WithIdempotencyKey("pedido-A-1042"))

fmt.Println(*invoice.UUID, *invoice.Total)
```

```java tab="Java"
import com.fiscalisto.*;
import com.fiscalisto.model.*;
import java.util.List;

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

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("Mensualidad").setProductKey("86121700").setQuantity(2).setUnitPrice(2500))),
        RequestOptions.idempotencyKey("pedido-A-1042"));

System.out.println(invoice.getUuid() + " " + invoice.getTotal());
```

You can also pass the key when creating the client: `new Fiscalisto("fk_test_…")`, `Fiscalisto("fk_test_…")`, `new Fiscalisto('fk_test_…')`, `new FiscalistoClient("fk_test_…")` (in C# and Java) or `fiscalisto.NewClient("fk_test_…")`. With an `fk_test_` key everything is stamped in SAT's test environment; with an `fk_live_` one, in live (see [Test and live](https://fiscalisto.com/en/docs/api/pruebas-y-produccion)).

## One method per route

Methods carry the resource's name and what they do. Fields are the API's own, in English with underscores, so the [reference](https://fiscalisto.com/en/docs/api/referencia/facturas/create-invoice) applies as is: every page has the example in all six languages.

| Route | TypeScript | Python | PHP |
| --- | --- | --- | --- |
| `POST /v1/invoices` | `invoices.create({…})` | `invoices.create({…})` | `invoices->create([…])` |
| `GET /v1/invoices/{id}` | `invoices.get("inv_…")` | `invoices.get("inv_…")` | `invoices->get('inv_…')` |
| `GET /v1/invoices/{id}/pdf` | `invoices.pdf(id)`: `Uint8Array` | `invoices.pdf(id)`: `bytes` | `invoices->pdf($id)`: `string` |
| `GET /v1/invoices/{id}/xml` | `invoices.xml(id)` | `invoices.xml(id)` | `invoices->xml($id)` |
| `POST /v1/invoices/{id}/cancel` | `invoices.cancel(id, { motive: "02" })` | `invoices.cancel(id, {"motive": "02"})` | `invoices->cancel($id, ['motive' => '02'])` |
| `POST /v1/payments` | `payments.create({…})` | `payments.create({…})` | `payments->create([…])` |
| `POST /v1/credit_notes` | `creditNotes.create({…})` | `credit_notes.create({…})` | `creditNotes->create([…])` |
| `POST /v1/invoice_batches` | `invoiceBatches.create({…})` | `invoice_batches.create({…})` | `invoiceBatches->create([…])` |
| `POST /v1/payroll_batches` | `payrollBatches.create({…})` | `payroll_batches.create({…})` | `payrollBatches->create([…])` |
| `GET /v1/sat_catalogs/{name}` | `satCatalogs.get("product_keys", { q })` | `sat_catalogs.get("product_keys", {"q": q})` | `satCatalogs->get('product_keys', ['q' => $q])` |
| `POST /v1/webhook_endpoints/{id}/roll_secret` | `webhookEndpoints.rollSecret(id)` | `webhook_endpoints.roll_secret(id)` | `webhookEndpoints->rollSecret($id)` |

In Python resources and methods use underscores (`credit_notes`, `roll_secret`); in TypeScript and PHP, `creditNotes` and `rollSecret`; in C#, capitalized with `Async` (`fiscalisto.CreditNotes.CreateAsync(…)`, `fiscalisto.WebhookEndpoints.RollSecretAsync(id)`), and fields as properties (`TaxId`, `UnitPrice`). In TypeScript each answer has its type (`Invoice`, `Customer`…); in Python it's a `TypedDict` your editor and `mypy` check; in PHP it's an array with its shape documented for PHPStan and Psalm; in C# it's a class (`Invoice`, `Customer`…) with each field's description in your editor, and so is what you send (`InvoiceCreate`, `CancelInvoiceParams`…), with `required` on what's mandatory so the compiler warns you.

In Go, each resource is a field of the client (`client.Invoices.Create(ctx, …)`, `client.WebhookEndpoints.RollSecret(ctx, id, nil)`), what you send is a struct (`InvoiceCreate`, `CancelInvoiceParams`…) and optional values are pointers: `fiscalisto.String("PUE")`, `fiscalisto.Float64(2500)`, `fiscalisto.Int64(10)`. A customer is an id or its data: `fiscalisto.IDOf[fiscalisto.InvoiceCreateCustomer]("cus_…")` or `fiscalisto.ObjectOf(fiscalisto.InvoiceCreateCustomer{…})`. In Java, each resource is a method (`fiscalisto.invoices().create(…)`, `fiscalisto.webhookEndpoints().rollSecret(id)`) and each class has chained setters (`new InvoiceCreate().setPaymentForm("03")`); amounts are `BigDecimal` and setters accept a number too.

```ts tab="TypeScript"
import { writeFile } from "node:fs/promises";

await writeFile("factura.pdf", await fiscalisto.invoices.pdf(invoice.id));
```

```python tab="Python"
from pathlib import Path

Path("factura.pdf").write_bytes(fiscalisto.invoices.pdf(invoice["id"]))
```

```php tab="PHP"
file_put_contents('factura.pdf', $fiscalisto->invoices->pdf($invoice['id']));
```

```csharp tab="C#"
await File.WriteAllBytesAsync("factura.pdf", await fiscalisto.Invoices.PdfAsync(invoice.Id));
```

```go tab="Go"
pdf, err := client.Invoices.PDF(ctx, invoice.ID, nil)
err = os.WriteFile("factura.pdf", pdf, 0o644)
```

```java tab="Java"
Files.write(Path.of("factura.pdf"), fiscalisto.invoices().pdf(invoice.getId()));
```

## Idempotency-Key without thinking

Whatever stamps always carries its `Idempotency-Key`. If you don't pass one, the SDK creates one per call and repeats it on its retries, so a network drop never stamps twice. Pass yours (`idempotencyKey`, `idempotency_key=`, `'idempotency_key' =>`, `new RequestOptions { IdempotencyKey = … }`, `fiscalisto.WithIdempotencyKey(…)` or `RequestOptions.idempotencyKey(…)`) when you want repeating the call from your system, even after a restart, to answer the same invoice. See [Idempotency](https://fiscalisto.com/en/docs/api/idempotencia).

## Safe retries

Each SDK sends a new `Idempotency-Key` on each `POST` (the same on its retries) and retries twice, with a growing wait (half a second, one, two… up to eight), only what can't do anything twice:

- `429`s (honoring `Retry-After` up to 60 seconds) and requests with the same `Idempotency-Key` still in progress (`409` `request_in_progress`).
- Network errors and `5xx`s: reads and deletes change nothing when repeated, and a `POST` with the same key answers what it did the first time.

If you pass your own key (your order's id), your retries are protected too even if your process restarts. A custom request without a key, through the generic request method, isn't repeated if it may have arrived. Change how many retries and how long to wait for each answer, for the whole client or for one call:

```ts tab="TypeScript"
const fiscalisto = new Fiscalisto(undefined, { maxRetries: 4, timeout: 30_000 }); // milisegundos

await fiscalisto.invoices.get("inv_…", { maxRetries: 0 });
```

```python tab="Python"
fiscalisto = Fiscalisto(max_retries=4, timeout=30)  # segundos

fiscalisto.invoices.get("inv_…", max_retries=0)
```

```php tab="PHP"
$fiscalisto = new Fiscalisto(null, ['max_retries' => 4, 'timeout' => 30]); // segundos

$fiscalisto->invoices->get('inv_…', ['max_retries' => 0]);
```

```csharp tab="C#"
var fiscalisto = new FiscalistoClient(options: new FiscalistoClientOptions { MaxRetries = 4, Timeout = TimeSpan.FromSeconds(30) });

await fiscalisto.Invoices.GetAsync("inv_…", options: new RequestOptions { MaxRetries = 0 });
```

```go tab="Go"
client, err := fiscalisto.NewClient("", fiscalisto.WithMaxRetries(4), fiscalisto.WithTimeout(30*time.Second))

invoice, err := client.Invoices.Get(ctx, "inv_…", nil, fiscalisto.WithRequestMaxRetries(0))
```

```java tab="Java"
var fiscalisto = new FiscalistoClient(ClientOptions.builder().maxRetries(4).timeout(Duration.ofSeconds(30)).build());

fiscalisto.invoices().get("inv_…", null, new RequestOptions().setMaxRetries(0));
```

In .NET you can pass your own `HttpClient` (for example from `IHttpClientFactory`) in `FiscalistoClientOptions.HttpClient`; use a single `FiscalistoClient` across the application (register it as a singleton). In Go pass your own `*http.Client` with `fiscalisto.WithHTTPClient(…)` and in Java your `HttpClient` with `ClientOptions.builder().httpClient(…)`; the Go and Java clients are also shared across threads and goroutines.

By default each answer is awaited 80 seconds: stamping can take as long as the PAC takes.

## Lists

Walking a list gives you every object, page by page, without handling `starting_after`. For a single page, read `data` and `has_more`:

```ts tab="TypeScript"
for await (const invoice of fiscalisto.invoices.list({ status: "valid", created_gte: "2026-10-01", limit: 100 })) {
  console.log(invoice.uuid, invoice.total);
}

const page = await fiscalisto.customers.list({ limit: 10 });
console.log(page.data.length, page.has_more);
```

```python tab="Python"
for invoice in fiscalisto.invoices.list({"status": "valid", "created_gte": "2026-10-01", "limit": 100}):
    print(invoice["uuid"], invoice["total"])

page = fiscalisto.customers.list({"limit": 10})
print(len(page.data), page.has_more)
```

```php tab="PHP"
foreach ($fiscalisto->invoices->list(['status' => 'valid', 'created_gte' => '2026-10-01', 'limit' => 100]) as $invoice) {
    echo $invoice['uuid'], ' ', $invoice['total'], "\n";
}

$page = $fiscalisto->customers->list(['limit' => 10]);
echo count($page->data()), ' ', $page->hasMore() ? 'hay más' : 'es todo';
```

```csharp tab="C#"
await foreach (var invoice in fiscalisto.Invoices.ListAutoPagingAsync(new ListInvoicesParams { Status = "valid", CreatedGte = "2026-10-01", Limit = 100 }))
    Console.WriteLine($"{invoice.Uuid} {invoice.Total}");

var page = await fiscalisto.Customers.ListAsync(new ListCustomersParams { Limit = 10 });
Console.WriteLine($"{page.Data.Count} {page.HasMore}");
```

```go tab="Go"
params := &fiscalisto.ListInvoicesParams{Status: fiscalisto.String("valid"), CreatedGte: fiscalisto.String("2026-10-01"), Limit: fiscalisto.Int64(100)}
for invoice, err := range client.Invoices.ListAutoPaging(ctx, params) {
	if err != nil {
		return err
	}
	fmt.Println(*invoice.UUID, *invoice.Total)
}

page, err := client.Customers.List(ctx, &fiscalisto.ListCustomersParams{Limit: fiscalisto.Int64(10)})
fmt.Println(len(page.Data), page.HasMore) // page.Next(ctx) da la siguiente
```

```java tab="Java"
for (var invoice : fiscalisto.invoices().listAutoPaging(new ListInvoicesParams().setStatus("valid").setCreatedGte("2026-10-01").setLimit(100))) {
    System.out.println(invoice.getUuid() + " " + invoice.getTotal());
}

var page = fiscalisto.customers().list(new ListCustomersParams().setLimit(10));
System.out.println(page.getData().size() + " " + page.hasMore()); // page.next() da la siguiente
```

## Errors

An API error throws `FiscalistoError` (in PHP, C# and Java, `FiscalistoException`; in Go the call returns a `*fiscalisto.Error`) with the same data as the [error body](https://fiscalisto.com/en/docs/api/errores). Decide with the code; show the message. Every code is in `ErrorCode` (`ErrorCode.InvoiceRejected`, `ErrorCode.INVOICE_REJECTED` in Python, `ErrorCode::INVOICE_REJECTED` in PHP, `ErrorCode.INVOICE_REJECTED` in Java, `fiscalisto.CodeInvoiceRejected` in Go), with its description in your editor: a misspelled code doesn't compile.

| Data | TypeScript | Python | PHP | C# | Go | Java |
| --- | --- | --- | --- | --- | --- | --- |
| Type (`invalid_request_error`, `invoice_error`…) | `error.type` | `e.type` | `$e->type` | `e.Type` | `e.Type` | `e.getType()` |
| Code (`invoice_rejected`…) | `error.code` | `e.code` | `$e->errorCode` | `e.Code` | `e.Code` | `e.getCode()` |
| What to fix | `error.message` | `e.message` | `$e->getMessage()` | `e.Message` | `e.Message` | `e.getMessage()` |
| Field with the problem | `error.param` | `e.param` | `$e->param` | `e.Param` | `e.Param` | `e.getParam()` |
| SAT code (`CFDI40145`…) | `error.satCode` | `e.sat_code` | `$e->satCode` | `e.SatCode` | `e.SatCode` | `e.getSatCode()` |
| The document that remained | `error.invoice` | `e.invoice` | `$e->invoice` | `e.Invoice` | `e.Invoice` | `e.getInvoice()` |
| HTTP status | `error.status` | `e.status` | `$e->status` | `e.StatusCode` | `e.StatusCode` | `e.getStatusCode()` |
| Request id, for support | `error.requestId` | `e.request_id` | `$e->requestId` | `e.RequestId` | `e.RequestID` | `e.getRequestId()` |

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

try {
  await fiscalisto.invoices.create(datos, { idempotencyKey: pedido.id });
} catch (error) {
  if (error instanceof FiscalistoError && error.code === ErrorCode.InvoiceRejected) {
    // El SAT no la aceptó: error.message dice qué corregir, error.param en qué campo.
    await avisarAlCliente(error.message);
  } else {
    throw error;
  }
}
```

```python tab="Python"
from fiscalisto import ErrorCode, FiscalistoError

try:
    fiscalisto.invoices.create(datos, idempotency_key=pedido.id)
except FiscalistoError as e:
    if e.code != ErrorCode.INVOICE_REJECTED:
        raise
    # El SAT no la aceptó: e.message dice qué corregir, e.param en qué campo.
    avisar_al_cliente(e.message)
```

```php tab="PHP"
use Fiscalisto\ErrorCode;
use Fiscalisto\FiscalistoException;

try {
    $fiscalisto->invoices->create($datos, ['idempotency_key' => $pedido->id]);
} catch (FiscalistoException $e) {
    if ($e->errorCode !== ErrorCode::INVOICE_REJECTED) {
        throw $e;
    }
    // El SAT no la aceptó: getMessage() dice qué corregir, $e->param en qué campo.
    avisarAlCliente($e->getMessage());
}
```

```csharp tab="C#"
try
{
    await fiscalisto.Invoices.CreateAsync(datos, new RequestOptions { IdempotencyKey = pedido.Id });
}
catch (FiscalistoException e) when (e.Code == ErrorCode.InvoiceRejected)
{
    // El SAT no la aceptó: e.Message dice qué corregir, e.Param en qué campo.
    await AvisarAlCliente(e.Message);
}
```

```go tab="Go"
_, err := client.Invoices.Create(ctx, datos, fiscalisto.WithIdempotencyKey(pedido.ID))
var e *fiscalisto.Error
if errors.As(err, &e) && e.Code == fiscalisto.CodeInvoiceRejected {
	// El SAT no la aceptó: e.Message dice qué corregir, e.Param en qué campo.
	avisarAlCliente(e.Message)
} else if err != nil {
	return err
}
```

```java tab="Java"
try {
    fiscalisto.invoices().create(datos, RequestOptions.idempotencyKey(pedido.getId()));
} catch (FiscalistoException e) {
    if (!ErrorCode.INVOICE_REJECTED.equals(e.getCode())) throw e;
    // El SAT no la aceptó: getMessage() dice qué corregir, getParam() en qué campo.
    avisarAlCliente(e.getMessage());
}
```

If the API doesn't answer, the type is `connection_error` (code `timeout` or `connection_failed`). With whatever stamps, repeat the call with the same `Idempotency-Key` to find out whether it was stamped. If what answered isn't the API (a proxy's page or a network portal's), the type is `api_error` with the code `invalid_response`.

## Webhooks

Verifying a webhook doesn't need the API key, only the endpoint's secret (`whsec_…`): `verifyWebhook` (TypeScript), `verify_webhook` (Python), `Webhook::verify` (PHP), `FiscalistoClient.Webhooks.Verify` (C#), `fiscalisto.VerifyWebhook` (Go) and `Webhooks.verify` (Java) check the signature and the time and give you the event: depending on `type`, `data.object` is an invoice, a withholding certificate or a batch. Pass the body exactly as it arrived, without parsing it. If the signature isn't valid or the event is more than 5 minutes old, it throws `FiscalistoWebhookError` (in PHP, `WebhookException`; in C#, `FiscalistoWebhookException`; in Java, `Webhooks.VerificationException`; in Go it returns an error with `errors.Is(err, fiscalisto.ErrWebhookSignature)`): answer `400`.

```ts tab="TypeScript"
// Next.js (app/webhooks/fiscalisto/route.ts); en Bun, Deno, Hono o Workers es igual.
import { FiscalistoWebhookError, verifyWebhook } from "fiscalisto";

export async function POST(request: Request) {
  try {
    const event = await verifyWebhook(
      await request.text(),
      request.headers,
      process.env.FISCALISTO_WEBHOOK_SECRET as string,
    );
    if (event.type === "invoice.stamped") await guardar(event.data.object.uuid);
    return new Response(null, { status: 200 });
  } catch (error) {
    if (error instanceof FiscalistoWebhookError) return new Response(null, { status: 400 });
    throw error;
  }
}
```

```python tab="Python"
# Flask; en Django use request.body y request.headers.
import os
from flask import Flask, request
from fiscalisto import FiscalistoWebhookError, verify_webhook

app = Flask(__name__)

@app.post("/webhooks/fiscalisto")
def fiscalisto_webhook():
    try:
        event = verify_webhook(
            request.get_data(), request.headers, os.environ["FISCALISTO_WEBHOOK_SECRET"]
        )
    except FiscalistoWebhookError:
        return "", 400
    if event["type"] == "invoice.stamped":
        guardar(event["data"]["object"]["uuid"])
    return "", 200
```

```php tab="PHP"
<?php
// PHP puro; en Laravel use $request->getContent() y $request->headers->all().
use Fiscalisto\Webhook;
use Fiscalisto\WebhookException;

try {
    $event = Webhook::verify(
        file_get_contents('php://input'),
        getallheaders(),
        getenv('FISCALISTO_WEBHOOK_SECRET'),
    );
} catch (WebhookException $e) {
    http_response_code(400);
    exit;
}
if ($event['type'] === 'invoice.stamped') {
    guardar($event['data']['object']['uuid']);
}
http_response_code(200);
```

```csharp tab="C#"
// ASP.NET Core (minimal API).
using Fiscalisto;

app.MapPost("/webhooks/fiscalisto", async (HttpRequest request) =>
{
    var body = await new StreamReader(request.Body).ReadToEndAsync();
    try
    {
        var @event = FiscalistoClient.Webhooks.Verify(
            body,
            name => request.Headers[name],
            Environment.GetEnvironmentVariable("FISCALISTO_WEBHOOK_SECRET")!);
        if (@event.Type == "invoice.stamped") await Guardar(@event.DataObject<Invoice>().Uuid);
        return Results.Ok();
    }
    catch (FiscalistoWebhookException)
    {
        return Results.BadRequest();
    }
});
```

```go tab="Go"
// net/http; en Gin use c.Request, en Echo c.Request().
func fiscalistoWebhook(w http.ResponseWriter, r *http.Request) {
	payload, _ := io.ReadAll(r.Body)
	event, err := fiscalisto.VerifyWebhook(payload, r.Header, os.Getenv("FISCALISTO_WEBHOOK_SECRET"))
	if err != nil {
		http.Error(w, "firma inválida", http.StatusBadRequest)
		return
	}
	if event.Type == "invoice.stamped" {
		invoice, _ := fiscalisto.DataObject[fiscalisto.Invoice](event)
		guardar(*invoice.UUID)
	}
	w.WriteHeader(http.StatusOK)
}
```

```java tab="Java"
// Spring Boot.
@PostMapping("/webhooks/fiscalisto")
ResponseEntity<Void> fiscalistoWebhook(@RequestBody byte[] body, @RequestHeader Map<String, String> headers) {
    try {
        var event = Webhooks.verify(body, headers, System.getenv("FISCALISTO_WEBHOOK_SECRET"));
        if (event.getType().equals("invoice.stamped")) guardar(event.dataObject(Invoice.class).getUuid());
        return ResponseEntity.ok().build();
    } catch (Webhooks.VerificationException e) {
        return ResponseEntity.badRequest().build();
    }
}
```

With a client already created, `fiscalisto.webhooks.verify(…)` (`$fiscalisto->webhooks->verify(…)` in PHP) does the same. During a secret roll two signatures arrive and one matching is enough. See [Webhooks](https://fiscalisto.com/en/docs/api/webhooks).

## Starter projects

A small app that already stamps, to copy what you need: a form that stamps a test invoice with its `Idempotency-Key`, the PDF and XML download, handling a SAT rejection and webhooks with the signature verified. None needs a database.

| Project | Download | Run it |
| --- | --- | --- |
| Next.js (App Router) | [nextjs.zip](https://fiscalisto.com/docs/api/starters/nextjs.zip) | `npm install && npm run dev` |
| Laravel | [laravel.zip](https://fiscalisto.com/docs/api/starters/laravel.zip) | `composer install && php artisan serve` |
| Django | [django.zip](https://fiscalisto.com/docs/api/starters/django.zip) | `pip install -r requirements.txt && python manage.py runserver` |
| ASP.NET Core | [aspnet.zip](https://fiscalisto.com/docs/api/starters/aspnet.zip) | `dotnet run` |

Put your key in `FISCALISTO_API_KEY` (each one has its `.env.example` and README) and, for webhooks on your computer, run `npx fiscalisto listen --forward-to http://localhost:…/webhooks/fiscalisto` (see [CLI](https://fiscalisto.com/en/docs/api/cli#webhooks-on-your-computer)).

## Postman, Bruno and Insomnia

To try it without writing code, import the [API collection](https://fiscalisto.com/docs/api/fiscalisto.postman_collection.json): one folder per resource, each route with its example and a new `Idempotency-Key` on whatever stamps. Postman opens it directly; in Bruno use **Import Collection › Postman Collection**, and in Insomnia **Import**. The key goes in the collection's `apiKey` variable. When you create a test key in **Desarrolladores › Llaves**, download it with your key already set.

## Other languages

For Ruby, Rust or anything else, call the API with your HTTP client (every reference page has the example with `curl` and `fetch`) or generate a client from the [OpenAPI](https://api.fiscalisto.com/v1/openapi.json) document.
