package
0.200.1
Repository: https://github.com/invopop/gobl.git
Documentation: pkg.go.dev

# README

🇨🇴 GOBL Colombia Tax Regime

Example CO GOBL files can be found in the examples (YAML uncalculated documents) and examples/out (JSON calculated envelopes) subdirectories.

Colombia specifics

Invoice Series & Code

Invoices ("Facturas de Venta") as expected in many countries require a series and unique sequential code to be issued for each document. The DIAN in colombia however have gone a step further and require invoice series to be pre-registered with the government.

Details on how to do this are available here.

Municipality codes

The DIAN requires that Colombian addresses in the invoice specificy its municipality code. The list of municipality codes is available here.

In a GOBL invoice, you can provide the supplier's or customer's municipality code using the co-dian-municipality extension. For example:

"supplier": {
  "name": "EXAMPLE SUPPLIER S.A.S.",
  "tax_id": {
    "country": "CO",
    "code": "9014514812"
  },
  "ext": {
    "co-dian-municipality": "11001" // Bogotá, D.C.
  },
  // [...]
},
"customer": {
  "name": "EXAMPLE CUSTOMER S.A.S.",
  "tax_id": {
    "country": "CO",
    "code": "9014514805"
  },
  "ext": {
    "co-dian-municipality": "05001" // Medellín
  },
  // [...]
},

Customer identities

While the DIAN requires suppliers of invoices to identify themselves using their NIT, in the case of customers, it allows various identification types. Each identification type has a specific code that must be sent to the DIAN.

B2B

In a GOBL invoice, Colombian business customers are required to provide a Tax ID with the company's NIT to be reported with the 31 (NIT) DIAN ID type. Foreign business customers must also provide a Tax ID with their country's VAT code, and that will be reported to the DIAN using the 50 (NIT de otro país) type.

For example:

"customer": {
  "name": "EXAMPLE CUSTOMER S.A.S.",
  "tax_id": {
    "country": "CO",
    "code": "9014514805" // NIT. DIAN type 31
  },
  "ext": {
    "co-dian-municipality": "11001"
  },
  "addresses": [
    {
      "street": "CRA 8 113 31 OF 703",
      "locality": "Bogotá, D.C.",
      "region": "Bogotá",
      "country": "CO"
    }
  ]
}

B2C

In the case of non-business customers, the GOBL invoice will need to include the tax tag simplified. That will allow to omit the customer or identify it with any of the other document types accepted by the DIAN. They'll just need to include an Identity object with any of the keys below:

GOBL Identity KeyDIAN ID typeDescription
co-civil-register11Registro civil
co-id-card12Tarjeta de identidad
co-citizen-id13Cédula de ciudadanía
co-foreigner-id-card21Tarjeta de extranjería
co-foreigner-id22Cédula de extranjería
co-passport41Pasaporte
co-foreign-id42Documento de identificación extranjero
co-pep47PEP (Permiso Especial de Permanencia)
co-nuip91NUIP

For example:

"tax": {
  "tags": ["simplified"]
},
"customer": {
  "name": "Ángel Pérez",
  "identities": [
    {
      "key": "co-passport", // DIAN type 41
      "code": "1234567890"
    }
  ]
}

Note that GOBL simplified invoices don't require a customer (or its identity) to be present. In the lack of a customer identity, the reserved code for final consumers (222222222222) will be automatically sent to the DIAN (i.e., no need to set it explicitly)

For example:

"tax": {
  "tags": ["simplified"]
},
"customer": { // The customer could be fully omitted as well
  "name": "Juan Fernández"
}

Credit and debit correction codes

The DIAN requires credit and debit notes sent to them to specify a code with a cause of the correction.

In a GOBL invoice, you'll need to include the extension co-dian-credit-code (for credit notes) or co-dian-debit-code (for debit notes) as part of the Preceding section of the document. Each extension allows a different set of values:

co-dian-credit-code

CodeDescription
1Partial refund
2Revoked
3Discount
4Adjustment
5Other

co-dian-debit-code

CodeDescription
1Interest
2Pending charges
3Change in value
4Other

For example:

"preceding": [
  {
    "uuid": "0190e063-7676-7000-8c58-2db7172a4e58",
    "type": "standard",
    "series": "SETT",
    "code": "1010006",
    "issue_date": "2024-07-23",
    "reason": "Reason",
    "stamps": [
      {
          "prv": "dian-cude",
          "val": "57601dd1ab69213ccf8cfd5894f2e9fbfe23643f3a24e2f2526a5bb88d058a0842fffcb339694b6704dc105a9d813327"
      }
    ],
    "ext": {
      "co-dian-debit-code": "3"
    }
  }
],

# Functions

New provides the tax region definition.
Normalize will attempt to clean the object passed to it.
Validate checks the document type and determines if it can be validated.

# Constants

Extension keys used in Colombia.
Extension keys used in Colombia.
Extension keys used in Colombia.
Known base tax identity types for Colombia.
Known base tax identity types for Colombia.
Known base tax identity types for Colombia.
Known base tax identity types for Colombia.
Known base tax identity types for Colombia.
Known base tax identity types for Colombia.
Known base tax identity types for Colombia.
Known base tax identity types for Colombia.
Known base tax identity types for Colombia.
Special keys to use in meta data.
Special keys to use in meta data.
Special keys to use in meta data.
DIAN official codes to include in stamps.
DIAN official codes to include in stamps.
Impuesto Consumo.
Impuesto de Industria y Comercio.
Local tax categories.
ReteICA.
ReteIVA.
ReteRenta.
Known base tax identity types for Colombia.