factus-js iconfactus-js
Facturas

Crear y validar factura

Crear y validar una factura electronica de venta ante la DIAN.

Firma del método

create(input: CreateInvoiceInput): Promise<ApiResponse<InvoiceListItem>>

Endpoint Factus

POST /v1/bills/validate

Fuente oficial: Factura avanzada

Parámetros

Prop

Type

Ejemplo

import {
  PaymentFormCode,
  PaymentMethodCode,
  IdentityDocumentTypeId,
  CustomerTributeId,
  OrganizationTypeId,
  ProductStandardId,
} from "factus-js";

const response = await factus.bills.create({
  numbering_range_id: 8,
  reference_code: "I3",
  observation: "Observaciones de la factura",
  payment_form: PaymentFormCode.CreditPayment,
  payment_method_code: PaymentMethodCode.Cash,
  payment_due_date: "2025-12-31",
  billing_period: {
    start_date: "2025-01-01",
    end_date: "2025-01-31",
  },
  customer: {
    identification: "123456789",
    dv: "3",
    company: "",
    trade_name: "",
    names: "Alan Turing",
    address: "calle 1 # 2-68",
    email: "alanturing@enigmasas.com",
    phone: "1234567890",
    legal_organization_id: OrganizationTypeId.NaturalPerson,
    tribute_id: CustomerTributeId.IVA,
    identification_document_id: IdentityDocumentTypeId.NIT,
    municipality_id: "149",
  },
  items: [
    {
      code_reference: "12345",
      name: "Producto ejemplo",
      quantity: 2,
      discount_rate: 20,
      price: 50000,
      tax_rate: "19.00",
      unit_measure_id: 70,
      standard_code_id: ProductStandardId.TaxpayerAdoption,
      is_excluded: 0,
      tribute_id: 1,
    },
  ],
});

console.log(response.data.number);

Ejemplo de respuesta

Ver respuesta oficial: Ejemplo de respuesta

En esta página