# 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.

# Packages

The anybill SDK is build with a modular software architecture to provide tools for a flexible integration of the anybill services into your products. Additionally every module can be customized and extended at your needs.

# Core features

Core Module
Contains fundamental technical functions
Authentication Module
Contains login and registration functions for the app
Bill Module
Contains functionalities to receive the receipts from the POS
Category Module
Provides categories to relate receipts and items to the corresponding categories

# Optional features

OCR Module
Paper receipts can be scanned via the anybill OCR-function
Document Manager Module
Permits the export of receipts directly to a document manager like GetMyInvoices, DATEV or fileee
Yoli Module
Connection to the bank account via PSD2 interface for a full financial overview
Smart Receipt Actions Module
Smart functions on a receipt based on the receipt data e.g. review of the shopping experience, recipe suggestions or adding of insurances
Expense Manager Module
Provides an automatically categorized overview of all expenses the user had
Marketing Module
Provides features to display offers customized on the customers purchasing behaviour
Loyalty Module
Provides features, to provide customer loyalty with personalized offers based on the customers purchasing behaviour
Tree Gamification Module
Offers a „tree level system“ to enhance the motivation of the user by planting trees for scanned receipts
Warranty Tracker Module
Notifies the user about due warranties
Shopping List Module
anybill provides a fully automatic shopping list with personalized suggestions based on the purchasing history

# Authentication

The anybill SDK supports three different methods of authentication. Fist by letting the user create or use his own anybill account with E-Mail or Password, second create an anonymous account over the SDK or last create an anybill user account over the partner platform API, link it to your user account and then use token to initialize the SDK.

# 1. Login/Register anybill user account

Let your users create and use real anybill user accounts. Here the user knows that he has an anybill user account and is able to login with it in the SDK or also the anybill App.

# Flow: let a user login with his anybill account

anybill SDK auth login

# 2. Anonymous user account

By using this functionality the SDK creates a anonymous user account in the background with no email or password. With this authentication method the App user can use the anybill services as if he had no user account. The anonymous user account can be converted to a normal anybill account with email and password later on.


After a App with a anonymous account gets deleted, it cannot be restored because there is no reference to the old account left. If you want an anonymous background user account which is linked to your App user account and you can continue to use after the deletion of the App please have a look at Linked user account.

# 3. Linked user account

If your App has an own user account system you can link a anybill user to your user account by using the anybill partner platform API. With this API you can create anybill user accounts and link them to your user account by saving the anybill user id. By knowing the anybill user id you can create access tokens for using the anybill App API. With this access token you can either use the App Api directly or initialize the SDK to automatically communicate with the anybill App API.

# Flow: init the SDK with a linked user token

anybill SDK auth token

# Flow: set a new token to the SDK after refreshing the previous token failed in the SDK

anybill SDK auth token refresh

# Data Models

# Authentication

data class AnybillUser(
    val id: String,
    val email: String,
    val password: String,
    val firstName: String,
    val lastName: String,
    val birthday: String,
    val gender: String
data class UserInfo {
    val firstName: String,
    val lastName: String,
    val birthday: String,
    val gender: String

# Category

data class Category(
    val id: String,
    val name: String,
    val iconResource: String,
    val color: Double

# Bills

abstract class Bill(
    open val id: String,
    open val categoryIds: List<String>,
    open val createdAtDate: String,
    open val currencyCode: String,
    open val date: String,
    open val discounts: List<Discount>,
    open val fileeeId: String,
    open val gmiDocumentId: Int,
    open val hasTaxReturnFlag: Boolean,
    open val isDeleted: Boolean,
    open val lastModifiedDate: String,
    open val lineItems: List<LineItem>,
    open val posBillId: String,
    open val returnBarcode: Boolean,
    open val returnCodeType: ReturnCodeType,
    open val tenders: List<Tender>,
    open val totalGrossAmount: Double,
    open val totalNetAmount: Double,
    open val totalTaxAmount: Double,
    open val type: BillType,
    open val warranties: List<Warranty>
data class NoScanBill
    val customText: String,
    val storeId: String,
    val vendor: Vendor,
    val legalInformation: LegalInformation,
    val store: Store
) : Bill()
data class ScanBill(
    val store: ScanStore,
    val vendorName: String,
    val hasScan: Boolean,
    val hasOCRRun: Boolean
) : Bill()
data class NoScanBillDTO(
    val vendorName: String,
    val date: String,
    val totalGrossAmount: Double,
    val categoryIds: List<String>,
    val currencyCode: String,
    val discounts: List<Discount>,
    val lineItems: List<LineItem>,
    val posBillId: String,
    val returnBarcode: String,
    val tenders: List<Tender>,
    val totalNetAmount: Double,
    val totalTaxAmount: Double
data class Discount(
    val name: String,
    val value: Double
data class LegalInformation(
    val beginDateTime: String,
    val cashierName: String,
    val endDateTime: String,
    val posInspectionQRData: String,
    val securityModuleNumber: String,
    val transactionId: String,
    val tseFailure: Boolean
data class LineItem(
    val name: String,
    val quantity: Double,
    val unitOriginalGrossPrice: Double,
    val quantityType: QuantityType? = QuantityType.Count,
    val priceModifier: PriceModifier? = PriceModifier.None,
    val vat: Double,
    val sequenceNumber: Int,
    val categoryId: String,
    val description: String,
    val discountValue: Double,
    val ean: String,
    val id: String,
    val returnBarcode: String,
    val text: String,
    val totalGrossPrice: Double,
    val totalNetPrice: Double,
    val totalVatAmount: Double,
    val unitGrossPrice: Double,
    val unitNetPrice: Double
data class Tender(
    val amount: Double,
    val currencyCode: String,
    val tenderType: TenderType,
    val detailedType: String,
    val id: String,
    val paymentDetails: PaymentDetailsBase
data class Warranty(
    val articleName: String,
    val billId: String,
    val id: String,
    val lineItemId: String,
    val reminders: List<Reminder>,
    val warrantyDate: String
data class Reminder(
    val days: Int

# Payment Details

data class PaymentDetails(
    val id: String
data class OnlinePaymentDetails(
    val id: String,
    val senderAccountName: String,
    val recipientAccountName: String,
    val transactionId: String
    ) : PaymentDetails()
data class LoyaltyCardPaymentDetails(
    val id: String,
    val name: String,
    val accountNumber: String,
    val pointsUsed: Double,
    val pointsLeft: Double,
    val pointsGained: Double
    ) : PaymentDetails()
data class GiftCardPaymentDetails(
    val id: String,
    val initialBalance: Double,
    val remainingBalance: Double,
    val dateOfExpiry: String
    ) : PaymentDetails()
data class DirectDebitPaymentDetails(
    val id: String,
    val sepaCreditorId: String,
    val sepaMandateReference: String,
    val cardNumber: String,
    val bankName: String
    ) : PaymentDetails()
data class CreditCardPaymentDetails(
    val id: String,
    val cardNumber: String,
    val bankName: String
    ) : PaymentDetails()
data class CheckPaymentDetails(
    val id: String,
    val drawee: String,
    val payee: String,
    val dateOfIssue: String,
    val drawer: String,
    val sortCode: String,
    val accountNumber: String
    ) : PaymentDetails()
data class CashPaymentDetails(
    val id: String,
    val amountGiven: Double,
    val amountReturned: Double
    ) : PaymentDetails()
data class BankTransferPaymentDetails(
    val id: String,
    val iban: String,
    val bic: String,
    val accountHolderName: String,
    val accountNumber: String,
    val bankName: String,
    val bankAddress: String,
    val sortCode: String,
    val routingNumber: String,
    val ifscCode: String,
    val routingCode: String
    ) : PaymentDetails()

# Vendor

data class Vendor(
    val id: String,
    val name: String,
    val categoryIds: List<String>,
    val iconResource: String
abstract class BaseStore
data class Store(
    val vatId: String,
    val id: String,
    val address: Address,
    val displayName: String,
    val googlePlacesId: String,
    val legalName: String
) : BaseStore()
data class ScanStore(
    val city: String,
    val country: String,
    val street: String,
    val vatId: String,
    val zip: String
): BaseStore()
data class Address(
    val zip: String,
    val city: String,
    val country: String,
    val number: String,
    val street: String