CipherCloud.Facturacion.Sdk
1.2.2
dotnet add package CipherCloud.Facturacion.Sdk --version 1.2.2
NuGet\Install-Package CipherCloud.Facturacion.Sdk -Version 1.2.2
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="CipherCloud.Facturacion.Sdk" Version="1.2.2" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="CipherCloud.Facturacion.Sdk" Version="1.2.2" />
<PackageReference Include="CipherCloud.Facturacion.Sdk" />
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add CipherCloud.Facturacion.Sdk --version 1.2.2
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: CipherCloud.Facturacion.Sdk, 1.2.2"
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package CipherCloud.Facturacion.Sdk@1.2.2
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=CipherCloud.Facturacion.Sdk&version=1.2.2
#tool nuget:?package=CipherCloud.Facturacion.Sdk&version=1.2.2
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
CipherCloud.Facturacion.Sdk
SDK .NET para consumir la API de Facturación CFDI 4.0 de CipherCloud. Proporciona métodos de alto nivel para emitir, cancelar, validar y consultar comprobantes fiscales digitales desde cualquier aplicación .NET.
Instalación
dotnet add package CipherCloud.Facturacion.Sdk
Configuración rápida
1. appsettings.json
{
"CipherCloudFacturacion": {
"BaseUrl": "https://api.tudominio.com",
"ApiKey": "tu-api-key",
"AppIdentifier": "tu-app-identifier",
"Timeout": "00:00:30"
}
}
2. Registrar en Program.cs
using CipherCloud.Facturacion.Sdk.Extensions;
builder.Services.AddCipherCloudFacturacionSdk(builder.Configuration);
3. Inyectar y usar
public class MiServicio
{
private readonly CipherCloudFacturacionClient _facturacion;
public MiServicio(CipherCloudFacturacionClient facturacion)
=> _facturacion = facturacion;
}
Métodos disponibles
| Método | Descripción |
|---|---|
EmitirFacturaAsync |
Emitir CFDI de Ingreso |
EmitirNotaCreditoAsync |
Emitir CFDI de Egreso (nota de crédito) |
EmitirPagoAsync |
Emitir complemento de pago (tipo P) |
CancelarFacturaAsync |
Cancelar CFDI por UUID (motivos 01–04) |
ValidarFacturaAsync |
Validar CFDI sin timbrar |
ObtenerFacturaPorUuidAsync |
Consultar detalle por UUID |
ObtenerFacturaPorExternalIdAsync |
Consultar por ID externo del ERP |
ListarFacturasAsync |
Listar con filtros y paginación |
Ejemplo: Emitir una factura
using CipherCloud.Facturacion.Sdk.Clients;
using CipherCloud.Facturacion.Sdk.Models.Requests;
using CipherCloud.Facturacion.Sdk.Models.Requests.Common;
var resultado = await _facturacion.EmitirFacturaAsync(new EmitInvoiceRequest
{
// ... datos del receptor y conceptos
});
Console.WriteLine($"UUID: {resultado.UUID}");
Console.WriteLine($"Total: {resultado.Total:C}");
Console.WriteLine($"Descarga ZIP: {resultado.ZipUrl}");
Ejemplo: Cancelar una factura
var resultado = await _facturacion.CancelarFacturaAsync("uuid-de-la-factura",
new CancelInvoiceRequest
{
Motivo = "02" // No se realizó la operación
});
Ejemplo: Listar facturas con filtros
var lista = await _facturacion.ListarFacturasAsync(
page: 1,
pageSize: 10,
dateFrom: new DateTime(2026, 1, 1),
dateTo: DateTime.Today,
estatus: "Emitida"
);
foreach (var factura in lista.Items)
Console.WriteLine($"{factura.Serie}-{factura.Folio}: {factura.Total:C}");
Ejemplo: Consultar por ID externo
var factura = await _facturacion.ObtenerFacturaPorExternalIdAsync("VENTA-001");
if (factura != null)
Console.WriteLine($"UUID: {factura.UUID}, Estatus: {factura.Estatus}, ZIP: {factura.ZipUrl}");
Manejo de errores
El SDK lanza excepciones tipadas según el tipo de error:
try
{
var resultado = await _facturacion.EmitirFacturaAsync(request);
}
catch (CipherCloudValidationException ex)
{
// Error 400 — datos inválidos
Console.WriteLine($"Validación: {ex.Message}");
Console.WriteLine($"Detalle: {ex.ResponseContent}");
}
catch (CipherCloudAuthException ex)
{
// Error 401/403 — API key o permisos
Console.WriteLine($"Auth: {ex.Message}");
}
catch (CipherCloudApiException ex)
{
// Otro error del servidor
Console.WriteLine($"API Error: {ex.Message}");
}
| Excepción | HTTP Status | Cuándo |
|---|---|---|
CipherCloudValidationException |
400 | Datos inválidos |
CipherCloudAuthException |
401 / 403 | API key inválida o sin permisos |
CipherCloudApiException |
5xx u otros | Error del servidor |
Uso sin Dependency Injection
var settings = new CipherCloudFacturacionSettings
{
BaseUrl = "https://api.tudominio.com",
ApiKey = "tu-api-key",
AppIdentifier = "tu-app-identifier"
};
var client = new CipherCloudFacturacionClient(settings);
var factura = await client.ObtenerFacturaPorUuidAsync("uuid");
Requisitos
- .NET 10.0 o superior
- API de Facturación CipherCloud activa con API key válida
Licencia
MIT
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net10.0 is compatible. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
-
net10.0
- Microsoft.Extensions.Configuration.Abstractions (>= 10.0.2)
- Microsoft.Extensions.Configuration.Binder (>= 10.0.2)
- Microsoft.Extensions.DependencyInjection.Abstractions (>= 10.0.2)
- Microsoft.Extensions.Http (>= 10.0.2)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.