Official .NET SDK for the Complyance Unified e-invoicing platform
$ dotnet add package Complyance.SDK.dotNetOfficial .NET SDK for the Complyance Unified e-invoicing platform.
Install the SDK via NuGet:
dotnet add package Complyance.SDK
// Configure the SDK
services.AddComplyanceSDK(options =>
{
options.ApiKey = "your-api-key";
options.Environment = Environment.Sandbox;
options.Sources.Add(new Source
{
Id = "source-id",
Type = SourceType.FirstParty,
Name = "My ERP System"
});
});
// Use the SDK
public class InvoiceController : ControllerBase
{
private readonly IComplyanceSDK _sdk;
public InvoiceController(IComplyanceSDK sdk)
{
_sdk = sdk;
}
[HttpPost]
public async Task<IActionResult> SubmitInvoice([FromBody] InvoiceData data, CancellationToken cancellationToken)
{
try
{
var request = new UnifyRequest
{
DocumentType = DocumentType.TaxInvoice,
Country = "SA",
Operation = Operation.Single,
Mode = Mode.Documents,
Purpose = Purpose.Invoicing,
Payload = data
};
var response = await _sdk.PushToUnifyAsync(request, cancellationToken);
return Ok(response);
}
catch (ComplyanceException ex)
{
return BadRequest(ex.Message);
}
}
}
For detailed documentation, visit https://docs.complyance.io/sdk/dotnet
MIT