Productos
Registrar tu catálogo de productos o servicios en Facturapi te permite almacenar todos los datos necesarios para facturar de manera centralizada y referenciar dicha información en futuras facturas.
Al crear una factura, puedes incluir la información de tu producto o servicio de 2 maneras distintas:
- En el campo
items
>product
, enviando un objeto con la información del producto o servicio. - En el campo
items
>product
, enviando elid
de un producto previamente registrado.
Ambas opciones son válidas y te recomendamos usar la que mejor se acomode a tu caso de uso.
Ejemplos
Los siguiente ejemplos muestran cómo registrar la información de tu producto o servicio para usarse en futuras facturas.
Para conocer todos los argumentos que puedes incluir en la llamada, consulta la referencia del método Crear Producto.
Producto con IVA 16% con impuestos incluídos (default)
Por default, se considera que el precio de un producto tiene impuestos incluídos, y que el producto tiene un impuesto de IVA 16%.
Facturapi se encarga de desglosar los impuestos y calcular el precio unitario.
- Node.js
- C#
- PHP
- cURL
const product = await facturapi.products.create({
description: 'Ukelele',
product_key: '60131324',
price: 345.60,
sku: 'ABC1234'
});
var product = await facturapi.Product.CreateAsync(new Dictionary<string, object>
{
["description"] = "Ukelele",
["product_key"] = "60131324",
["price"] = 345.60,
["sku"] = "ABC1234"
});
$facturapi = new FacturapiClient('API_KEY');
$product = $facturapi->Products->create([
"description" => "Ukelele",
"product_key" => "4319150114",
"price" => 345.60,
"sku" => "ABC1234"
];
$new_product = $product );
curl https://www.facturapi.io/v1/products \
-H "Authorization: Bearer sk_test_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"description": "Ukelele",
"product_key": "60131324",
"price": 345.60,
"sku": "ABC1234"
}'
que es equivalente a:
- Node.js
- C#
- PHP
- cURL
const product = await facturapi.products.create({
description: 'Ukelele',
product_key: '60131324',
price: 345.60,
sku: 'ABC1234',
tax_included: true,
taxes: [
{
type: 'IVA',
rate: 0.16
}
]
});
var product = await facturapi.Product.CreateAsync(new Dictionary<string, object>
{
["description"] = "Ukelele",
["product_key"] = "60131324",
["price"] = 345.60,
["sku"] = "ABC1234",
["tax_included"] = true,
["taxes"] = new List<Dictionary<string, object>>
{
new Dictionary<string, object>
{
["type"] = "IVA",
["rate"] = 0.16
}
}
});
$product = $facturapi->Products->create([
"description" => "Ukelele",
"product_key" => "4319150114",
"price" => 345.60,
"sku" => "ABC1234",
"tax_included" => true,
"taxes" => [
[
"type" => "IVA",
"rate" => 0.16
]
]
]);
curl https://www.facturapi.io/v1/products \
-H "Authorization: Bearer sk_test_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"description": "Ukelele",
"product_key": "60131324",
"price": 345.60,
"sku": "ABC1234",
"tax_included": true,
"taxes": [
{
"type": "IVA",
"rate": 0.16
}
]
}'
Este producto se facturaría como:
Precio unitario | 297.93 |
IVA 16% | 47.67 |
Precio total | 345.60 |
Producto con precio unitario antes de impuestos
- Node.js
- C#
- PHP
- cURL
const product = await facturapi.products.create({
description: 'Ukelele',
product_key: '60131324',
price: 345.60,
sku: 'ABC1234',
tax_included: false,
taxes: [
{
type: 'IVA',
rate: 0.16
}
]
});
var product = await facturapi.Product.CreateAsync(new Dictionary<string, object>
{
["description"] = "Ukelele",
["product_key"] = "60131324",
["price"] = 345.60,
["sku"] = "ABC1234",
["tax_included"] = false,
["taxes"] = new List<Dictionary<string, object>>
{
new Dictionary<string, object>
{
["type"] = "IVA",
["rate"] = 0.16
}
}
});
$facturapi = new FacturapiClient('API_KEY');
$product = $facturapi->Products->create([
"description" => "Ukelele",
"product_key" => "4319150114",
"price" => 345.60,
"sku" => "ABC1234",
"tax_included" => false,
"taxes" => [
[
"type" => "IVA",
"rate" => 0.16
]
]
];
$new_product = $product );
curl https://www.facturapi.io/v1/products \
-H "Authorization: Bearer sk_test_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"description": "Ukelele",
"product_key": "60131324",
"price": 345.60,
"sku": "ABC1234",
"tax_included": false,
"taxes": [
{
"type": "IVA",
"rate": 0.16
}
]
}'
Este producto se facturaría como:
Precio unitario | 345.60 |
IVA 16% | 55.30 |
Precio total | 400.90 |
Producto con IVA tasa 0
- Node.js
- C#
- PHP
- cURL
const product = await facturapi.products.create({
description: 'Ukelele',
product_key: '60131324',
price: 345.60,
sku: 'ABC1234',
tax_included: false,
taxes: [
{
type: 'IVA',
rate: 0
}
]
});
var product = await facturapi.Product.CreateAsync(new Dictionary<string, object>
{
["description"] = "Ukelele",
["product_key"] = "60131324",
["price"] = 345.60,
["sku"] = "ABC1234",
["tax_included"] = false,
["taxes"] = new List<Dictionary<string, object>>
{
new Dictionary<string, object>
{
["type"] = "IVA",
["rate"] = 0
}
}
});
$facturapi = new FacturapiClient('API_KEY');
$product = $facturapi->Products->create([
"description" => "Ukelele",
"product_key" => "4319150114",
"price" => 345.60,
"sku" => "ABC1234",
"tax_included" => false,
"taxes" => [
[
"type" => "IVA",
"rate" => 0
]
]
];
$new_product = $product );
curl https://www.facturapi.io/v1/products \
-H "Authorization: Bearer sk_test_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"description": "Ukelele",
"product_key": "60131324",
"price": 345.60,
"sku": "ABC1234",
"tax_included": false,
"taxes": [
{
"type": "IVA",
"rate": 0
}
]
}'
Producto con IVA exento
- Node.js
- C#
- PHP
- cURL
const product = await facturapi.products.create({
description: 'Ukelele',
product_key: '60131324',
price: 345.60,
sku: 'ABC1234',
tax_included: false,
taxes: [
{
type: 'IVA',
factor: 'Exento',
rate: 0
}
]
});
var product = await facturapi.Product.CreateAsync(new Dictionary<string, object>
{
["description"] = "Ukelele",
["product_key"] = "60131324",
["price"] = 345.60,
["sku"] = "ABC1234",
["tax_included"] = false,
["taxes"] = new List<Dictionary<string, object>>
{
new Dictionary<string, object>
{
["type"] = "IVA",
["factor"] = "Exento",
["rate"] = 0
}
}
});
$facturapi = new FacturapiClient('API_KEY');
$product = $facturapi->Products->create([
"description" => "Ukelele",
"product_key" => "4319150114",
"price" => 345.60,
"sku" => "ABC1234",
"tax_included" => false,
"taxes" => [
[
"type" => "IVA",
"factor" => "Exento",
"rate" => 0
]
]
];
$new_product = $product );
curl https://www.facturapi.io/v1/products \
-H "Authorization: Bearer sk_test_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"description": "Ukelele",
"product_key": "60131324",
"price": 345.60,
"sku": "ABC1234",
"tax_included": false,
"taxes": [
{
"type": "IVA",
"factor": "Exento",
"rate": 0
}
]
}'