Skip to main content
The .NET SDK currently has limited service coverage compared to the JavaScript and Python SDKs. It focuses on invoicing, file management, and billing. Additional service clients for expenses, vendors, and reports are coming soon.

InvoiceClient

The InvoiceClient provides full lifecycle management for invoices, including CRUD operations, sending, voiding, and retrieving summaries. Access it via client.Invoices.

Create an Invoice

Get an Invoice by ID

List Invoices

Returns a paginated SBList<SBInvoice> with metadata:

Update an Invoice

Delete an Invoice

Send an Invoice

Sends the invoice to the customer via email:

Void an Invoice

Marks the invoice as void (cannot be undone):

Get Invoice Summary

Returns aggregate statistics across all invoices:

Method Reference

All methods accept optional SBRequestOptions options and CancellationToken ct parameters. IDs use the long type.

FileClient

The FileClient handles file retrieval and updates through the Smartbills file service. Access it via client.Files.

Get a File

Retrieve a file by its key:

Update a File

Update file metadata:

Method Reference


BillingClient

The BillingClient provides access to billing and subscription management. It includes sub-clients for checkout sessions, customer management, and payment methods. Access it via client.Billing.

Checkout Sessions

Manage checkout sessions for payments:

Customers

Manage billing customers:

Payment Methods

Manage payment methods:

Async Patterns

CancellationToken Support

All async methods accept a CancellationToken for cooperative cancellation:

Parallel Operations

Execute multiple independent operations concurrently:

ASP.NET Core Controller Example

Using the SDK with dependency injection in a controller:

Error Handling

The SDK throws exceptions for API errors. Wrap calls in try-catch blocks:

Common Error Codes

Pagination

List endpoints return SBList<T> which includes both the data and pagination metadata:

Complete Example

An end-to-end example creating, listing, sending, and voiding invoices: