# Purchase receipts

> Save the photo of a receipt the issuer paid without an invoice, with the store, its RFC and the total, and request the invoice or mark it non-deductible.

Your users pay for gas, meals and stationery with a receipt, and the invoice stays pending. Send the photo (or the PDF) of each receipt with its data: the store, its RFC, the date, the total, the payment form, the folio, the data its portal asks for (Web ID, branch…) and the invoicing link from the QR. Then request the invoice from the store or mark it non-deductible. When that store's invoice arrives with the [SAT downloads](https://fiscalisto.com/en/docs/api/descargas-del-sat), the receipt becomes `invoiced` on its own.

It's the same as **Compras y gastos › Tickets de compra** in the app.

## Save a receipt

Send the file in base64 with its `file_type` (`image/jpeg`, `image/png`, `image/webp` or `application/pdf`), up to 8 MB. Scale the photo down before sending it (2,000 px on the long side is enough). If your app already read the QR code, send it in `qr_text`: it's the most reliable source for the portal link, and if the store invoices with Fiscalisto it fills in the folio and the total on its own.

```bash tab="cURL"
curl https://api.fiscalisto.com/v1/purchase_receipts \
  -H "Authorization: Bearer $FISCALISTO_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "file": "/9j/4AAQSkZJRgABAQAAAQABAAD...",
    "file_type": "image/jpeg",
    "qr_text": "https://facturacion.laspalmas.mx/?ticket=A-48213",
    "store_name": "Gasolinera Las Palmas",
    "store_tax_id": "GLP0503158A2",
    "date": "2026-10-30",
    "total": 348.5
  }'
```

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

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

const purchaseReceipt = await fiscalisto.purchaseReceipts.create({
  file: "/9j/4AAQSkZJRgABAQAAAQABAAD...",
  file_type: "image/jpeg",
  qr_text: "https://facturacion.laspalmas.mx/?ticket=A-48213",
  store_name: "Gasolinera Las Palmas",
  store_tax_id: "GLP0503158A2",
  date: "2026-10-30",
  total: 348.5,
});
```

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

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

purchase_receipt = fiscalisto.purchase_receipts.create({
    "file": "/9j/4AAQSkZJRgABAQAAAQABAAD...",
    "file_type": "image/jpeg",
    "qr_text": "https://facturacion.laspalmas.mx/?ticket=A-48213",
    "store_name": "Gasolinera Las Palmas",
    "store_tax_id": "GLP0503158A2",
    "date": "2026-10-30",
    "total": 348.5,
})
```

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

use Fiscalisto\Fiscalisto;

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

$purchaseReceipt = $fiscalisto->purchaseReceipts->create([
    'file' => '/9j/4AAQSkZJRgABAQAAAQABAAD...',
    'file_type' => 'image/jpeg',
    'qr_text' => 'https://facturacion.laspalmas.mx/?ticket=A-48213',
    'store_name' => 'Gasolinera Las Palmas',
    'store_tax_id' => 'GLP0503158A2',
    'date' => '2026-10-30',
    'total' => 348.5,
]);
```

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

	purchaseReceipt, err := client.PurchaseReceipts.Create(ctx, &fiscalisto.CreatePurchaseReceiptParams{
		File:       "/9j/4AAQSkZJRgABAQAAAQABAAD...",
		FileType:   "image/jpeg",
		QrText:     fiscalisto.String("https://facturacion.laspalmas.mx/?ticket=A-48213"),
		StoreName:  fiscalisto.String("Gasolinera Las Palmas"),
		StoreTaxID: fiscalisto.String("GLP0503158A2"),
		Date:       fiscalisto.String("2026-10-30"),
		Total:      fiscalisto.Float64(348.5),
	})
	if err != nil {
		log.Fatal(err)
	}
	fmt.Println(purchaseReceipt.ID)
}
```

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

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

var purchaseReceipt = fiscalisto.purchaseReceipts().create(new CreatePurchaseReceiptParams()
        .setFile("/9j/4AAQSkZJRgABAQAAAQABAAD...")
        .setFileType("image/jpeg")
        .setQrText("https://facturacion.laspalmas.mx/?ticket=A-48213")
        .setStoreName("Gasolinera Las Palmas")
        .setStoreTaxId("GLP0503158A2")
        .setDate("2026-10-30")
        .setTotal(348.5));
System.out.println(purchaseReceipt.getId());
```

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

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

var purchaseReceipt = await fiscalisto.PurchaseReceipts.CreateAsync(new CreatePurchaseReceiptParams
{
    File = "/9j/4AAQSkZJRgABAQAAAQABAAD...",
    FileType = "image/jpeg",
    QrText = "https://facturacion.laspalmas.mx/?ticket=A-48213",
    StoreName = "Gasolinera Las Palmas",
    StoreTaxId = "GLP0503158A2",
    Date = "2026-10-30",
    Total = 348.5m,
});
```

Returns `201` with the saved receipt. Fiscalisto doesn't read the photo: it stores the data you send (`store_tax_id`, `total`, `date`, `fields`…) and what's missing is filled in later with `POST /v1/purchase_receipts/{id}`. To find the invoice when it arrives from SAT, `store_tax_id` and `total` are needed. The same file twice returns the receipt that was already there.

Saving receipts uses no timbres. Each receipt counts toward the daily purchase receipt limit: 100 a day in test mode and 5,000 in production. See [Limits](https://fiscalisto.com/en/docs/api/limites).

## Correct its data

```bash tab="cURL"
curl https://api.fiscalisto.com/v1/purchase_receipts/rct_OufpKqnrvx9p4X \
  -H "Authorization: Bearer $FISCALISTO_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "total": 348.5,
    "payment_method": "tarjeta",
    "use": "G03"
  }'
```

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

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

const purchaseReceipt = await fiscalisto.purchaseReceipts.update("rct_OufpKqnrvx9p4X", {
  total: 348.5,
  payment_method: "tarjeta",
  use: "G03",
});
```

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

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

purchase_receipt = fiscalisto.purchase_receipts.update("rct_OufpKqnrvx9p4X", {
    "total": 348.5,
    "payment_method": "tarjeta",
    "use": "G03",
})
```

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

use Fiscalisto\Fiscalisto;

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

$purchaseReceipt = $fiscalisto->purchaseReceipts->update('rct_OufpKqnrvx9p4X', [
    'total' => 348.5,
    'payment_method' => 'tarjeta',
    'use' => 'G03',
]);
```

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

	purchaseReceipt, err := client.PurchaseReceipts.Update(ctx, "rct_OufpKqnrvx9p4X", &fiscalisto.UpdatePurchaseReceiptParams{
		Total:         fiscalisto.Float64(348.5),
		PaymentMethod: fiscalisto.String("tarjeta"),
		Use:           fiscalisto.String("G03"),
	})
	if err != nil {
		log.Fatal(err)
	}
	fmt.Println(purchaseReceipt.ID)
}
```

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

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

var purchaseReceipt = fiscalisto.purchaseReceipts().update("rct_OufpKqnrvx9p4X", new UpdatePurchaseReceiptParams()
        .setTotal(348.5)
        .setPaymentMethod("tarjeta")
        .setUse("G03"));
System.out.println(purchaseReceipt.getId());
```

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

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

var purchaseReceipt = await fiscalisto.PurchaseReceipts.UpdateAsync("rct_OufpKqnrvx9p4X", new UpdatePurchaseReceiptParams
{
    Total = 348.5m,
    PaymentMethod = "tarjeta",
    Use = "G03",
});
```

Only what you send changes; `null` clears a field. `use` is the CFDI use requested: by default G03 if the issuer's regime allows it, otherwise S01, and it only accepts the expense uses its regime allows.

## Request the invoice

`POST /v1/purchase_receipts/{id}/request` with `method`:

- `fiscalisto`: the store invoices with Fiscalisto (`store.on_fiscalisto` is `true`, its QR is a self-invoicing link). The invoice is stamped right away with the issuer's tax data, the store sends it to `reply_to` and the receipt becomes `invoiced` with its `invoice_uuid`.
- `email`: we send the store (`to`, or `store.email`) the issuer's tax data, the receipt's and the photo. Replies reach `reply_to`, or the issuer's reply-to address. The receipt becomes `requested`.
- `portal` or `manual`: you requested it on the store's portal (`store.portal_url`) or in person. It only becomes `requested`.

```bash tab="cURL"
curl https://api.fiscalisto.com/v1/purchase_receipts/rct_OufpKqnrvx9p4X/request \
  -H "Authorization: Bearer $FISCALISTO_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "method": "portal"
  }'
```

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

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

const purchaseReceipt = await fiscalisto.purchaseReceipts.requestInvoice("rct_OufpKqnrvx9p4X", { method: "portal" });
```

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

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

purchase_receipt = fiscalisto.purchase_receipts.request_invoice("rct_OufpKqnrvx9p4X", {"method": "portal"})
```

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

use Fiscalisto\Fiscalisto;

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

$purchaseReceipt = $fiscalisto->purchaseReceipts->requestInvoice('rct_OufpKqnrvx9p4X', ['method' => 'portal']);
```

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

	purchaseReceipt, err := client.PurchaseReceipts.RequestInvoice(ctx, "rct_OufpKqnrvx9p4X", &fiscalisto.RequestPurchaseReceiptInvoiceParams{
		Method: "portal",
	})
	if err != nil {
		log.Fatal(err)
	}
	fmt.Println(purchaseReceipt.ID)
}
```

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

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

var purchaseReceipt = fiscalisto.purchaseReceipts().requestInvoice("rct_OufpKqnrvx9p4X", new RequestPurchaseReceiptInvoiceParams().setMethod("portal"));
System.out.println(purchaseReceipt.getId());
```

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

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

var purchaseReceipt = await fiscalisto.PurchaseReceipts.RequestInvoiceAsync("rct_OufpKqnrvx9p4X", new RequestPurchaseReceiptInvoiceParams
{
    Method = "portal",
});
```

To request it, the issuer needs its legal name, tax regime and postal code; if one is missing it returns `purchase_receipt_invalid` and says which.

## When the invoice arrives

You don't have to do anything: if a received invoice from that store arrives with the SAT downloads (same RFC, to the issuer's RFC, for the same total within one peso and dated from the purchase to 120 days after), the receipt becomes `invoiced` and `invoice` carries the invoice (`sat_…`). If you got it some other way, use `mark_invoiced`, with `invoice` if you know which one:

```bash tab="cURL"
curl https://api.fiscalisto.com/v1/purchase_receipts/rct_OufpKqnrvx9p4X/mark_invoiced \
  -H "Authorization: Bearer $FISCALISTO_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "invoice": "sat_OufpKqnrvx9p1Dn"
  }'
```

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

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

const purchaseReceipt = await fiscalisto.purchaseReceipts.markInvoiced("rct_OufpKqnrvx9p4X", { invoice: "sat_OufpKqnrvx9p1Dn" });
```

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

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

purchase_receipt = fiscalisto.purchase_receipts.mark_invoiced("rct_OufpKqnrvx9p4X", {"invoice": "sat_OufpKqnrvx9p1Dn"})
```

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

use Fiscalisto\Fiscalisto;

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

$purchaseReceipt = $fiscalisto->purchaseReceipts->markInvoiced('rct_OufpKqnrvx9p4X', ['invoice' => 'sat_OufpKqnrvx9p1Dn']);
```

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

	purchaseReceipt, err := client.PurchaseReceipts.MarkInvoiced(ctx, "rct_OufpKqnrvx9p4X", &fiscalisto.MarkPurchaseReceiptInvoicedParams{
		Invoice: fiscalisto.String("sat_OufpKqnrvx9p1Dn"),
	})
	if err != nil {
		log.Fatal(err)
	}
	fmt.Println(purchaseReceipt.ID)
}
```

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

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

var purchaseReceipt = fiscalisto.purchaseReceipts().markInvoiced("rct_OufpKqnrvx9p4X", new MarkPurchaseReceiptInvoicedParams()
        .setInvoice("sat_OufpKqnrvx9p1Dn"));
System.out.println(purchaseReceipt.getId());
```

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

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

var purchaseReceipt = await fiscalisto.PurchaseReceipts.MarkInvoicedAsync("rct_OufpKqnrvx9p4X", new MarkPurchaseReceiptInvoicedParams
{
    Invoice = "sat_OufpKqnrvx9p1Dn",
});
```

One invoice covers only one receipt.

## If they don't give you an invoice

`POST /v1/purchase_receipts/{id}/mark_non_deductible` leaves it as a non-deductible expense. `reopen` undoes it: it goes back to `requested` if it had been requested, otherwise to `pending`.

Two warnings each receipt carries:

- `cash_over_limit`: more than $2,000 was paid in cash. Even with an invoice, that expense isn't deductible (LISR art. 27, sec. III).
- `days_left_in_month`: the days left in the purchase's month, in Mexico time. The law sets no deadline for the buyer, but many stores only invoice within the month.

## Look them up

`GET /v1/purchase_receipts` lists them newest to oldest, with `status` to see only `pending`, `requested`, `invoiced` or `non_deductible`. `DELETE /v1/purchase_receipts/{id}` deletes the receipt and its file.
