# Get a customer's prices

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

What a customer pays for some products at a quantity: the unit price without VAT from their list (theirs, their group's or everyone's), their discount and the next wholesale tier. It saves nothing.

## 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. |
| `customer` | string | yes | The customer (cus_…) or their RFC. |
| `items` | array of object | yes | Line items (Conceptos), at least one. (up to 100) |
| `items[].product` | string | yes | The product (prd_…). |
| `items[].quantity` | number |  | Quantity (Cantidad). 1 by default. (greater than 0 and up to 1000000000) |
| `items[].unit` | string or null |  | Customs unit (UnidadAduana), c_UnidadAduana. |

Example:

```json
{
  "customer": "cus_OufpKqnrvx9p1",
  "items": [
    {
      "product": "prd_OufpKqnrvx9p1",
      "quantity": 10
    }
  ]
}
```

## With the TypeScript SDK

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

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

const priceQuote = await fiscalisto.prices.quote({
  customer: "cus_OufpKqnrvx9p1",
  items: [
    {
      product: "prd_OufpKqnrvx9p1",
      quantity: 10,
    },
  ],
}, { idempotencyKey: "pedido-A-1042" });
```

## With the Python SDK

```python
from fiscalisto import Fiscalisto

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

price_quote = fiscalisto.prices.quote({
    "customer": "cus_OufpKqnrvx9p1",
    "items": [
        {
            "product": "prd_OufpKqnrvx9p1",
            "quantity": 10,
        },
    ],
}, idempotency_key="pedido-A-1042")
```

## With the PHP SDK

```php
<?php

use Fiscalisto\Fiscalisto;

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

$priceQuote = $fiscalisto->prices->quote([
    'customer' => 'cus_OufpKqnrvx9p1',
    'items' => [
        [
            'product' => 'prd_OufpKqnrvx9p1',
            'quantity' => 10,
        ],
    ],
], ['idempotency_key' => 'pedido-A-1042']);
```

## With the .NET SDK

```csharp
using Fiscalisto;

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

var priceQuote = await fiscalisto.Prices.QuoteAsync(new QuotePricesParams
{
    Customer = "cus_OufpKqnrvx9p1",
    Items = new()
    {
        new()
        {
            Product = "prd_OufpKqnrvx9p1",
            Quantity = 10,
        },
    },
}, 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()

	priceQuote, err := client.Prices.Quote(ctx, &fiscalisto.QuotePricesParams{
		Customer: "cus_OufpKqnrvx9p1",
		Items: []fiscalisto.QuotePricesParamsItem{
			{
				Product:  "prd_OufpKqnrvx9p1",
				Quantity: fiscalisto.Float64(10),
			},
		},
	}, fiscalisto.WithIdempotencyKey("pedido-A-1042"))
	if err != nil {
		log.Fatal(err)
	}
	fmt.Printf("%+v\n", *priceQuote)
}
```

## With the Java SDK

```java
import com.fiscalisto.FiscalistoClient;
import com.fiscalisto.RequestOptions;
import com.fiscalisto.model.QuotePricesParams;
import com.fiscalisto.model.QuotePricesParamsItem;
import java.util.List;

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

var priceQuote = fiscalisto.prices().quote(new QuotePricesParams()
        .setCustomer("cus_OufpKqnrvx9p1")
        .setItems(List.of(
                new QuotePricesParamsItem()
                        .setProduct("prd_OufpKqnrvx9p1")
                        .setQuantity(10)
        )), RequestOptions.idempotencyKey("pedido-A-1042"));
System.out.println(priceQuote);
```

## Response 200

OK.

A `PriceQuote` object:

| Field | Type | Always present | Description |
| --- | --- | --- | --- |
| `object` | `"price_quote"` | yes | What kind of object it is («invoice», «customer»…). |
| `livemode` | boolean | yes | true in production (fk_live_ keys), false in test mode (fk_test_). Test objects aren't valid before the SAT. |
| `customer` | string | yes | The customer (cus_…) whose prices were calculated. |
| `items` | array of object | yes | Line items (Conceptos), at least one. |
| `items[].product` | string | yes | A product from your catalog (prd_…): takes its key, unit, price and taxes. |
| `items[].quantity` | number | yes | Quantity (Cantidad). 1 by default. |
| `items[].unit` | string or null | yes | Customs unit (UnidadAduana), c_UnidadAduana. |
| `items[].unit_price` | number | yes | Unit price before taxes (ValorUnitario). |
| `items[].catalog_price` | number | yes | Its catalog price, per unit and without IVA, before their list. |
| `items[].discount_percent` | number | yes | The customer's discount (their own, or their group's) on that price; it goes as Descuento in the CFDI. |
| `items[].price_list` | string or null | yes | The list (prl_…) the price comes from, or null if it is the catalog's. |
| `items[].next_step` | object or null | yes | The next wholesale tier: from what quantity and at what price. null if there is none. |
| `items[].next_step.min_quantity` | number | yes | From how many units (of its presentation) this price applies: a wholesale tier. 1 by default. |
| `items[].next_step.unit_price` | number | yes | Unit price before taxes (ValorUnitario). |

```json
{
  "object": "price_quote",
  "livemode": false,
  "customer": "cus_OufpKqnrvx9p1",
  "items": [
    {
      "product": "prd_OufpKqnrvx9p1",
      "quantity": 10,
      "unit": null,
      "unit_price": 90,
      "catalog_price": 100,
      "discount_percent": 3,
      "price_list": "prl_OufpKqnrvx9p1",
      "next_step": {
        "min_quantity": 24,
        "unit_price": 80
      }
    }
  ]
}
```

## Errors

- `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.

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