# Save a purchase receipt

`POST https://api.fiscalisto.com/v1/purchase_receipts`

The photo or PDF of a receipt the issuer paid without an invoice, in base64, with the data you have: the store, its RFC, the date, the total, the payment method, the folio, the data its portal asks for and the invoicing link. If qr_text is the link of a store that invoices with Fiscalisto, the folio and the total fill themselves in. The same file twice returns the receipt that was already there. If an invoice from that store for the same total arrives with the SAT downloads, the receipt becomes invoiced on its own.

## Parameters

| Name | In | Required | Description |
| --- | --- | --- | --- |
| `Idempotency-Key` | header |  | Optional (the SDKs send it on their own). If the response is lost, repeat the request with the same value within 24 hours: it answers the same, with idempotent-replayed: true, and doesn't do it twice (it doesn't create, send emails or charge). |

## Body

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `issuer` | string |  | Issuer (iss_…). If the key has a single issuer or the account has only one, it can be left out. |
| `file` | string | yes | The photo (JPG, PNG or WebP) or the PDF, in base64; up to 8 MB. |
| `file_type` | `image/jpeg`, `image/png`, `image/webp`, `application/pdf` | yes | image/jpeg, image/png, image/webp or application/pdf. |
| `qr_text` | string |  | What the receipt's QR code says, if you already read it (it's usually the portal's link). (up to 1000 characters) |
| `store_name` | string or null |  | The store's name. |
| `store_tax_id` | string or null |  | The store's RFC (the one that invoices). |
| `date` | string or null |  | The day of the purchase (YYYY-MM-DD). |
| `total` | number or null |  | The total paid, in pesos. |
| `payment_method` | `efectivo`, `tarjeta`, `otro` or null |  | efectivo (cash), tarjeta (card) or otro (other). |
| `folio` | string or null |  | The folio or receipt number. |
| `fields` | array of object |  | Other data the store's portal asks for (Web ID, branch, register…), up to 8. (up to 8) |
| `fields[].label` | string | yes | What the receipt calls it (Web ID, Sucursal…). (up to 40 characters) |
| `fields[].value` | string | yes | What the receipt says in that field. (up to 80 characters) |
| `portal_url` | string or null |  | The address of the store's invoicing portal (or the self-invoicing link of its QR). |
| `store_email` | string or null |  | The store's invoicing email. |
| `use` | string or null |  | The CFDI use (G03, I01…). G03 by default if the issuer's regime allows it. |
| `note` | string or null |  | A note for your team. |

Example:

```json
{
  "file": "/9j/4AAQSkZJRgABAQAAAQABAAD/2wBDAAgGBgcGBQgHBwcJCQgKDBQNDAsLDBkSEw8UHR8eHR8eHR8…",
  "file_type": "image/jpeg",
  "qr_text": "https://facturacion.laspalmas.mx/?ticket=A-48213"
}
```

## With the TypeScript SDK

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

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

const purchaseReceipt = await fiscalisto.purchaseReceipts.create({
  file: "/9j/4AAQSkZJRgABAQAAAQABAAD/2wBDAAgGBgcGBQgHBwcJCQgKDBQNDAsLDBkSEw8UHR8eHR8eHR8…",
  file_type: "image/jpeg",
  qr_text: "https://facturacion.laspalmas.mx/?ticket=A-48213",
}, { idempotencyKey: "pedido-A-1042" });
```

## With the Python SDK

```python
from fiscalisto import Fiscalisto

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

purchase_receipt = fiscalisto.purchase_receipts.create({
    "file": "/9j/4AAQSkZJRgABAQAAAQABAAD/2wBDAAgGBgcGBQgHBwcJCQgKDBQNDAsLDBkSEw8UHR8eHR8eHR8…",
    "file_type": "image/jpeg",
    "qr_text": "https://facturacion.laspalmas.mx/?ticket=A-48213",
}, idempotency_key="pedido-A-1042")
```

## With the PHP SDK

```php
<?php

use Fiscalisto\Fiscalisto;

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

$purchaseReceipt = $fiscalisto->purchaseReceipts->create([
    'file' => '/9j/4AAQSkZJRgABAQAAAQABAAD/2wBDAAgGBgcGBQgHBwcJCQgKDBQNDAsLDBkSEw8UHR8eHR8eHR8…',
    'file_type' => 'image/jpeg',
    'qr_text' => 'https://facturacion.laspalmas.mx/?ticket=A-48213',
], ['idempotency_key' => 'pedido-A-1042']);
```

## With the .NET SDK

```csharp
using Fiscalisto;

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

var purchaseReceipt = await fiscalisto.PurchaseReceipts.CreateAsync(new CreatePurchaseReceiptParams
{
    File = "/9j/4AAQSkZJRgABAQAAAQABAAD/2wBDAAgGBgcGBQgHBwcJCQgKDBQNDAsLDBkSEw8UHR8eHR8eHR8…",
    FileType = "image/jpeg",
    QrText = "https://facturacion.laspalmas.mx/?ticket=A-48213",
}, new RequestOptions { IdempotencyKey = "pedido-A-1042" });
```

## 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()

	purchaseReceipt, err := client.PurchaseReceipts.Create(ctx, &fiscalisto.CreatePurchaseReceiptParams{
		File:     "/9j/4AAQSkZJRgABAQAAAQABAAD/2wBDAAgGBgcGBQgHBwcJCQgKDBQNDAsLDBkSEw8UHR8eHR8eHR8…",
		FileType: "image/jpeg",
		QrText:   fiscalisto.String("https://facturacion.laspalmas.mx/?ticket=A-48213"),
	}, fiscalisto.WithIdempotencyKey("pedido-A-1042"))
	if err != nil {
		log.Fatal(err)
	}
	fmt.Println(purchaseReceipt.ID)
}
```

## With the Java SDK

```java
import com.fiscalisto.FiscalistoClient;
import com.fiscalisto.RequestOptions;
import com.fiscalisto.model.CreatePurchaseReceiptParams;

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

var purchaseReceipt = fiscalisto.purchaseReceipts().create(new CreatePurchaseReceiptParams()
        .setFile("/9j/4AAQSkZJRgABAQAAAQABAAD/2wBDAAgGBgcGBQgHBwcJCQgKDBQNDAsLDBkSEw8UHR8eHR8eHR8…")
        .setFileType("image/jpeg")
        .setQrText("https://facturacion.laspalmas.mx/?ticket=A-48213"), RequestOptions.idempotencyKey("pedido-A-1042"));
System.out.println(purchaseReceipt.getId());
```

## Response 201

OK.

A `PurchaseReceipt` object:

| Field | Type | Always present | Description |
| --- | --- | --- | --- |
| `id` | string | yes | Object identifier, with its prefix (iss_, inv_, ret_, cus_, prd_, emp_, bat_, brn_, whs_, stm_, adj_, evt_, whe_). |
| `livemode` | boolean | yes | true in production (fk_live_ keys), false in test mode (fk_test_). Test objects aren't valid before the SAT. |
| `object` | `"purchase_receipt"` | yes | What kind of object it is («invoice», «customer»…). |
| `issuer` | string | yes | The issuer (the one that bought). |
| `status` | `pending`, `requested`, `invoiced`, `non_deductible` | yes | pending (to request), requested (requested from the store), invoiced (it has an invoice now) or non_deductible (there was no invoice). |
| `store` | object | yes | The store: name, tax_id (its RFC), email, portal_url (its portal or the QR's link) and on_fiscalisto (invoices with Fiscalisto: method fiscalisto stamps it right away). |
| `store.name` | string or null | yes | Name. |
| `store.tax_id` | string or null | yes | RFC (Rfc), 12 characters for a persona moral and 13 for a persona física. |
| `store.email` | string or null | yes | Email to send it to (several separated by commas). Only used if sending is requested. |
| `store.portal_url` | string or null | yes | Its invoicing portal or the QR's link, or null. |
| `store.on_fiscalisto` | boolean | yes | true if it invoices with Fiscalisto: method fiscalisto stamps the invoice right away. |
| `date` | string or null | yes | The purchase day (YYYY-MM-DD), or null. |
| `total` | number or null | yes | The total paid, in pesos, or null. |
| `payment_method` | `efectivo`, `tarjeta`, `otro` or null | yes | efectivo, tarjeta or otro, or null. |
| `folio` | string or null | yes | The folio or ticket number, or null. |
| `fields` | array of object | yes | Other details the store's portal asks for to invoice (Web ID, branch, register…). |
| `fields[].label` | string | yes | What the receipt calls it (Web ID, Sucursal…). |
| `fields[].value` | string | yes | What the receipt says in that field. |
| `use` | string or null | yes | The CFDI use requested, or null: G03 if the issuer's tax regime allows it, otherwise S01. |
| `note` | string or null | yes | A note, or null. |
| `file_type` | string or null | yes | The saved file's type (image/jpeg, application/pdf…). |
| `cash_over_limit` | boolean | yes | true if more than $2,000 was paid in cash: even with an invoice, it isn't deductible (LISR art. 27 fr. III). |
| `days_left_in_month` | integer or null | yes | To request: the days left in the purchase's month, Mexico time (many stores only invoice within the month); otherwise null. |
| `requested` | object or null | yes | When and how it was requested (method: fiscalisto, email, portal or manual; to: the store or its email), or null. |
| `requested.method` | string or null | yes | egreso (the full invoice and then a credit note for the advance payment, option A) or remanente (the invoice only for what's left, option B). |
| `requested.to` | string or null | yes | To whom (emails separated by commas). |
| `requested.at` | string (date-time) or null | yes | When it was requested. |
| `invoice_uuid` | string or null | yes | The tax folio of the invoice that covers it, or null. |
| `invoice` | string or null | yes | The received invoice (sat_…) that covers it, if it already arrived with the SAT downloads, or null. |
| `invoiced_at` | string (date-time) or null | yes | When it was invoiced, or null. |
| `non_deductible_at` | string (date-time) or null | yes | When it was marked non-deductible, or null. |
| `created_at` | string (date-time) or null | yes | When it was saved. |

```json
{
  "id": "rct_OufpKqnrvx9p4X",
  "object": "purchase_receipt",
  "livemode": false,
  "issuer": "iss_OufpKqnrvx9p",
  "status": "pending",
  "store": {
    "name": "Gasolinera Las Palmas",
    "tax_id": "GLP0503158A2",
    "email": null,
    "portal_url": "https://facturacion.laspalmas.mx",
    "on_fiscalisto": false
  },
  "date": "2026-10-30",
  "total": 348.5,
  "payment_method": "tarjeta",
  "folio": "A-48213",
  "fields": [
    {
      "label": "Web ID",
      "value": "7Q3K9"
    }
  ],
  "use": null,
  "note": null,
  "file_type": "image/jpeg",
  "cash_over_limit": false,
  "days_left_in_month": 1,
  "requested": null,
  "invoice_uuid": null,
  "invoice": null,
  "invoiced_at": null,
  "non_deductible_at": null,
  "created_at": "2026-10-30T18:20:00-06:00"
}
```

## Errors

- `daily_limit` (429): You reached today's limit of something not paid with stamps. Retry-After says how many seconds until midnight in Mexico City.
- `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.
- `purchase_receipt_invalid` (400): The purchase receipt can't be saved, changed or requested that way. `message_es` says why.
- `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.
