
.NET Core, Framework and third-party SDKs
The Billecta SDK offers comprehensive models and stub methods for remote calls. We currently offer official SDKs for .NET Framework and .NET Core (.NET 5 compatible).
Each section in the API has its own Connector in the .NET SDK library. Initiating a connector is made through the following code.
var dc = new DebtorConnector("[SECURETOKEN]", true);
or
var dc = new DebtorConnector("[USERNAME]", "[PASSWORD]", true);
Both SecureToken sign in and username/password sign in is supported in the library. The third parameter (ReThrowErrors) defines if exceptions should be swallowed by the connector, and in case of an exception instead return null, or rethrow exceptions from the api server to the calling application (your application).
If ReThrowErrors parameter is set to false then null or nothing (in void methods) is returned and any error is found in the dc.HasError
and dc.Error
properties.
To quickly get started with the SDK, here are some practical examples:
Billecta.Connector.DebtorConnector dc = new Billecta.Connector.DebtorConnector("", "", true);
Guid creditorPublicId = /* Enter the owner creditor public id here */;
DebtorView debtor = new DebtorView
{
CreditorPublicId = creditorPublicId,
Name = "Acme AB",
Address = "Address 1",
ZipCode = "11173",
City = "Stockholm",
ContactEmail = "john.doe@acme.com",
ContactName = "John Doe",
CountryCode = "SE",
Email = "invoice@acme.com",
OrgNo = "556677-8899",
VatNumber = "SE556677889901",
};
var created = dc.CreateDebtor(debtor);
Guid debtorPublicId = Guid.Parse(created.PublicId); // save debtorPublicId on you side
Billecta.Connector.InvoiceConnector ic = new Billecta.Connector.InvoiceConnector("", "", true);
Guid creditorPublicId = /* Enter the owner creditor public id here */;
Guid shoesProductPublicId = /* Retreive the shoes product public id here */;
Guid socksProductPublicId = /* Retreive the socks product public id here */;
InvoiceActionEntryView debtor = new InvoiceActionEntryView
{
CreditorPublicId = creditorPublicId,
CommunicationLanguage = LanguageTypeView.SV,
DebtorPublicId = debtorPublicId,
DeliveryMethod = DeliveryMethodTypeView.Email,
InvoiceDate = DateTime.Now,
DueDate = DateTime.Now.AddDays(20),
InvoiceNumber = null, // when set to null Billecta api will generate invoice number for you
InvoiceFee = new AmountView(2500, "SEK"), // 25 SEK invoice fee
InvoicePDF = null, // when set to null Billecta wil generate the invoice pdf
OurReference = "John Doe", // you contact person
YourReference = "Customer contact name",
InterestPercentage = 8,
InterestTermsInDays = 365, // interest ticks 8% every 360 days
InterestType = InterestTypeView.AboveEffectiveReference,
InterestStartInDaysAfterDueDate = 0, // start ticking invoice from first due date
Records = new List
{
new InvoiceActionRecordView
{
SequenceNo = 0,
ArticleNumber = 1,
ArticleDescription = "Socks",
ProductPublicId = socksProductPublicId,
Quantity = 10,
Units = "pairs",
RecordType = RecordTypeView.Standard,
UnitPrice = new AmountView(10000, "SEK"), // costs 100 SEK each pair
VAT = 25,
},
new InvoiceActionRecordView
{
SequenceNo = 1,
ArticleNumber = 4,
ArticleDescription = "Shoes",
ProductPublicId = shoesProductPublicId,
Quantity = 2,
Units = "pairs",
RecordType = RecordTypeView.Standard,
UnitPrice = new AmountView(50000, "SEK"), // costs 500 SEK each pair
VAT = 25,
},
new InvoiceActionRecordView
{
SequenceNo = 3,
ArticleDescription = "Thank you for purchasing at Acme",
RecordType = RecordTypeView.Message
}
}
};
var created = ic.CreateInvoice(debtor);
string actionPublicId = created.PublicId;
There is an open source PHP SDK initiated by Johan Eliasson (elitan). The SDK is not complete but a good start and may be contributed to. Please note that this is third-party maintained by the open source community.
A Rust client library for the Billecta API, available on crates.io. This SDK provides type-safe access to Billecta's invoicing and payment services. Please note that this is third-party maintained by the open source community.