Skip to content

AfipSDK/afip.net

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Afip.Net

NuGet Contributors License

Librería para conectarse a los Web Services de AFIP con .NET

Explorar documentación · Comunidad Afip SDK · Reportar un bug

Acerca del proyecto

Con más de 100k descargas, desde el 2017, Afip SDK es la plataforma preferida entre los desarrolladores para conectarse a los web services de ARCA. Esta librería permite integrar fácilmente la facturación electrónica y otros servicios de ARCA en aplicaciones .NET.

Versiones soportadas

Plataforma Versión mínima
.NET Framework 4.6.1
.NET Core 2.0
.NET 5.0+

Instalación

dotnet add package Afip.Net

Uso

using AfipSDK.Afip.Net;

var afip = new Afip(new AfipOptions
{
    CUIT = "TU_CUIT",
    Production = false,
    AccessToken = "TU_ACCESS_TOKEN",
});

Facturación electrónica

// Obtener el último número de comprobante
var puntoDeVenta = 1;
var tipoDeFactura = 6; // 6 = Factura B

var lastVoucher = await afip.ElectronicBilling.GetLastVoucherAsync(puntoDeVenta, tipoDeFactura);
var numeroDeFactura = lastVoucher + 1;

// Crear comprobante
var data = new Dictionary<string, object?>
{
    ["CantReg"]  = 1,
    ["PtoVta"]   = puntoDeVenta,
    ["CbteTipo"] = tipoDeFactura,
    ["Concepto"] = 1,           // 1 = Productos
    ["DocTipo"]  = 99,          // 99 = Consumidor Final
    ["DocNro"]   = 0,
    ["CbteDesde"] = numeroDeFactura,
    ["CbteHasta"] = numeroDeFactura,
    ["CbteFch"]  = int.Parse(DateTime.UtcNow.ToString("yyyyMMdd")),
    ["ImpTotal"] = 121m,
    ["ImpTotConc"] = 0,
    ["ImpNeto"]  = 100m,
    ["ImpOpEx"]  = 0,
    ["ImpIVA"]   = 21m,
    ["ImpTrib"]  = 0,
    ["MonId"]    = "PES",
    ["MonCotiz"] = 1,
    ["CondicionIVAReceptorId"] = 5, // 5 = Consumidor Final
    ["Iva"] = new[]
    {
        new Dictionary<string, object?>
        {
            ["Id"]      = 5, // 5 = 21%
            ["BaseImp"] = 100m,
            ["Importe"] = 21m
        }
    }
};

var response = await afip.ElectronicBilling.CreateVoucherAsync(data);
Console.WriteLine($"CAE: {response["CAE"]}");
Console.WriteLine($"Vencimiento: {response["CAEFchVto"]}");

Documentación

Explorar documentación

Comunidad

Comunidad Afip SDK

Contacto

Soporte de Afip SDK - ayuda@afipsdk.com

https://github.com/afipsdk/afip.net

Este software y sus desarrolladores no tienen ninguna relación con la AFIP.

About

Libreria para usar los Web Services de AFIP con .NET

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors

Languages