# The anybill SDK

# Overview

With the anybill SDK, which is available for Android and iOS, the services provided by anybill can be easily integrated natively into any app.

# Architecture

To be able to use the anybill SDK, the endpoints for the desired features must be connected in the POS software.

# Functional description

In the following section, the individual features are described in detail and it is shown how these can be integrated.

# Authentication

To be able to use the anybill functions, the user has to first log in or register with an anybill account. The SDK provides the following functionality:


AnybillSdk anybillSdk = new AnybillSdk();
AnbillLoginCredentials anybillLoginCredentials = AnbillLoginCredentials();
AnybillUser anybillUser = await anybillSdk.login(anybillLoginCredentials);

Register a new user with anybill.


AnybillSdk anybillSdk = new AnybillSdk();
AnbillRegisterUser anybillRegisterUser = AnbillRegisterUser();
AnybillUser anybillUser = await anybillSdk.registerUser(anybillLoginCredentials);

Returns a bool value if an anybill user is logged in.

Authentication status

AnybillSdk anybillSdk = new AnybillSdk();
bool isAuthenticated = anybillSdk.isAuthenticated;

Returns the currently logged in anybill user.

Query user

AnybillSdk anybillSdk = new AnybillSdk();
AnybillUser anybillUser = anybillSdk.getUser();

# Retrieve digital receipts

Returns a list of all saved receipts.

Retrieve documents

AnybillSdk anybillSdk = new AnybillSdk();
List<AnybillBaseBill> bills = await anybillSdk.getBills();

Returns a list of all saved documents, sorted by month and category. This makes it easy to display an expenditure control, comparable to overview of expenses in the anybill App.

Retrieve documents for the expenditure manager

AnybillSdk anybillSdk = new AnybillSdk();
List<AnybillExpensesMonth> expenses = await anybillSdk.getExpenses();

# OCR and Scan Bills

Analyzes an image file using OCR and displays the data contained in it in a AnybillScanBill Object back.

Analyze document from image file using OCR

AnybillSdk anybillSdk = new AnybillSdk();
File imageFile = getSomePhotoFromCamera();
AnybillScanBill scanBill = await anybillSdk.analyzeBill(imageFile);

Saves a ScanBill object to the anybill account. The ScanBill object can be either created by OCR or added manually by the user.

Add document manually

AnybillSdk anybillSdk = new AnybillSdk();
AnybillScanBill newScanBill = new AnybillScanBill();
AnybillScanBill responseScanBill = await anybillSdk.addScanBill(newScanBill);

# Data Models

class AnybillLoginCredentials {
    String email;
    String password;
class AnybillRegisterUser {
    String firstname;
    String email;
    String password;
    String repeatPassword;
class AnybillUser {
    String firstname;
    String email;
class AnybillExpensesMonth {
    DateTime month;
    List<Category> categories;
class AnybillBaseBill {
    String id;
    DateTime date;
    DateTime createdAtDate;
    double totalGrossAmount;
    double totalNetAmount;
    double totalTaxAmount;
    String currencyCode;
    List<CategoryWithoutBills> categories
    List<Tender> tenders;
    List<LineItem> lineItems;
    bool isDeleted;
class AnybillBill extends AnybillBaseBill {
    String customText;
    Store store;
    String transactionId;
    String securityModuleNumber;
    DateTime beginDateTime;
    DateTime endDateTime;
class AnybillScanBill extends AnybillBaseBill {
    String vendorName;
    bool hasScan;
    File imgFile;
class LineItem {
    String id;
    double quantity;
    int quantityType;
    double unitGrossPrice;
    double unitNetPrice;
    double unitOriginalGrossPrice;
    double totalNetPrice;
    double totalGrossPrice;
    double totalVatAmount;
    double vat;
    String text;
    int sequenceNumber;
    int priceModifier;
    String name;
    String description;
    String ean;
class Category {
    String id;
    String name;
    String iconResource;
    Color color;
    List<AnybillBaseBill> bills;
class CategoryWithoutBills {
    String id;
    String name;
    String iconResource;
    Color color;
class Tender {
    int tenderType;
    String detailedType;
    String currencyCode;
    double amount;