Skip to content

AfipCreateInvoice

Issues an electronic voucher (Invoice A, B or C) to Argentina’s AFIP through the AFIP SDK server. The node automatically computes the next voucher number by querying the last authorized one, and retrieves the CAE (Electronic Authorization Code) required for the invoice to be legally valid.

FieldTypeRequiredDescription
credentials_idcredentialsYesAFIP SDK server credential
voucher_typeselectNoType: 1=Invoice A, 6=Invoice B, 11=Invoice C (default: 6)
point_of_salenumberYesPoint of sale number registered in AFIP
conceptselectNo1=Products, 2=Services, 3=Both (default: 1)
doc_typeselectNo99=Final Consumer, 80=CUIT, 96=DNI (default: 99)
doc_numbertextNoReceiver document number (0 for final consumer)
total_amountnumberYesTotal amount including VAT
iva_rateselectNoVAT rate: 21%, 10.5% or 0% (default: 21%)
currencyselectNoPES=Pesos, DOL=Dollars (default: PES)
issue_datetextNoIssue date YYYYMMDD (default: today)

This module requires an afip credential type with the following fields:

  • Server URL: URL of the AFIP SDK server (e.g. http://localhost:4000)
  • Token: Authentication token for the SDK server (optional depending on configuration)
  • CUIT: Tax ID of the issuing company
  • Environment: homologation (testing) or production
{
"success": true,
"cae": "71234567890123",
"cae_fch_vto": "20251231",
"voucher_number": 42,
"voucher_type": 6,
"point_of_sale": 1,
"issue_date": "20251201",
"total_amount": 1210,
"raw": { ... }
}
{
"credentials_id": "cred-afip-prod",
"voucher_type": "6",
"point_of_sale": "1",
"concept": "1",
"doc_type": "99",
"doc_number": "0",
"total_amount": "1210",
"iva_rate": "21"
}
{
"credentials_id": "cred-afip-prod",
"voucher_type": "1",
"point_of_sale": "1",
"concept": "2",
"doc_type": "80",
"doc_number": "30123456789",
"total_amount": "5000",
"iva_rate": "21"
}
  1. AfipGetLastVoucher — query the last authorized number
  2. AfipCreateInvoice — issue the invoice (next number is computed internally)
  3. Save CAE to database
  • The voucher number is automatically incremented by querying the last authorized one
  • For Invoice B to final consumers (doc_type=99), VAT is not itemized in the AFIP XML
  • If the SDK server does not return a CAE, the node returns an error even if the HTTP status is 200
  • The raw field contains the full SDK server response for debugging