Billing

repo: kdeldycke/awesome-billing
category: Business related: Indie



<p align="center"> <i>Money is the most universal and most efficient system of mutual trust ever devised.</i><br> — Yuval Noah Harari<sup id="intro-quote-ref"><a href="#intro-quote-def">[1]</a></sup> </p>

Any company needs at one point to get money from customers. That's when things gets messy for us developers, as we try to reconcile the complexity of the business with our software stack.

This Awesome list helps software engineers bootstrap billing & payments systems, and make sense of invoicing, pricing, accounting, marketplace, fraud and business intelligence.

Contents

Basics

<img align="right" width="50%" src="./assets/cloud-software-stack-billing.jpg"/>

In a Stanford class providing an overview of cloud computing, the software architecture of the platform is described as in the right diagram →

Billing is one of the transversal pillar of the ecosystem, where customers, products and business meets. The other pillar being Identity and Access Management (IAM) 👤.

This highlight the strategic importance of the domain, not only for cloud providers but virtually any business, especially those who are software-centric.

Pricing

From monthly subscription to commodity-like on-the-go consumption, there's plenty of scheme out there to structure your product's pricing. Including the good old shopping-cart funnel.

Usage-based Pricing

The dynamic scheme for elastic resources.

  • Why I Love Usage-Based Pricing - “The most important reason I like this pricing model is that it heavily incentivizes both the customer and the service provider to act in everyone's best interest.” Also details issues with other pricing models.

  • Use-cases for cloud services - The reason usage-based pricing makes even more sense for cloud services: to optimize ROI, keep all regular workload in traditional architecture and reserve cloud computing for elastic and experimental projects.

  • Socially Optimal Pricing of Cloud Computing Resources - “The socially optimal operating point is unique, and can be sustained by a linear, usage-based tariff, which charges a fixed price per unit resource and unit time.” This paper justify usage-based pricing for cloud resources.

  • A Survey of Profit Optimization Techniques for Cloud Providers - “The strategy of improving user service quality is discussed first, followed by the pricing strategy for cloud resources to maximize revenue.”

  • “Billing is not complex on purpose: it's the price to pay for elasticity.” (source) - Or why you're likely to get an endless stream of complaining users if choosing utility pricing scheme: while accurate to the (milli-)cent, this model is frustrating for customers not ready to invest time grasping the underlying concepts.

  • Riemann sum - The starting point about quantization of usage.

  • Allen's interval algebra - Implementing usage-based pricing is tricky, and this algebra will help you organize temporal reasoning. Also see this Stack Overflow question with clean schema.

  • Reconcile Your Monthly GCP Invoice with BigQuery Billing Export - Behind the quest of this developer to track its expenses, you get a glimpse on cloud billing difficulties. While not explicitly pointed out, pricing cloud resources is hard and the result of quantization, granularity and rounding, between space, time and currencies.

  • AWS EC2 T2 Instances Demystified: Don't Learn The Hard Way - An example of really tricky burstable instances which accrues and limits its own amount of CPU usage credits.

  • “Designing billing for a service can be really challenging” - Personal anecdote on the design of the pricing plan for AWS Simple Email Service.

  • Subscription-based pricing is dead: Smart SaaS companies are shifting to usage-based models - Usage-based pricing is more optimal and more fair: it “allows a customer to start at a low cost, minimizing friction to getting started while still preserving the ability to monetize a customer over time”.

  • Electropedia: Tariffs for electricity - Before the cloud, there was another metered resource priced by its usage: electricity. Here is a detailed (and multi-lingual) taxonomy of its vocabulary from the International Electrotechnical Commission.

  • Lago - Open-source metering & usage-based billing in Ruby.

  • CGRateS - An open-source, fast (50k+ CPS) and scalable (load-balancer + replication included) real-time billing for ISPs and Telecom Operators, written in Go.

Subscription Plans

Highly popular for SaaS businesses, subscription plans are easy to comprehend.

  • Pricing low-touch SaaS - “In low-touch SaaS, the most common way packages are presented are as different columns in a pricing grid, with each column corresponding to a plan, offered at a different price, with differential access to features or maximum allowable usage along some axis interesting to the business.”

  • Lotus - Open-source project to manage pricing & packaging infrastructure.

  • f-license - Open-source license key generation and verification tool in Go.

Hybrid

Uncommon pricing schemes.

  • The Three Part Tariff - Beyond linear pricing, there is a place for additional platform fees and free-tiers in the pricing structure.

Strategy

Theory and practical insight to help you choose the right pricing tactics.

Market Research

Survey methods and price discovery techniques to find the right price point.

  • Jeremy Howard - From Predictive Modelling to Optimization - “In insurance, the price is the product. (…) How do I change price to make shitload of money?” Or how to deliver results (optimal price for a customer) instead of delivering data (calculating a customer's risk, which had been the standard approach used by actuaries previously).

  • Gabor–Granger method - Used in surveys to determine the price for a new product or service. The results can be used to produce a demand chart and a revenue curve.

  • Van Westendorp's Price Sensitivity Meter - PSM is a market technique for determining consumer price preferences. Allows for drawing a revenue curve to estimate the price point delivering the maximum revenue.

  • Pricing niche products - “The most compelling argument against simply picking a price, though, is that it limits how much you can learn about your market.” Then the author setup vickrey auctions to discover price.

  • Finding the max revenue price mark for digital products - “To find the optimal price that provides maximum revenue for your product you will need to field-test several price points; you then reconstruct the revenue curve and find the peak.”

  • Personalised pricing and EU law - Some cases of price personalisation are prohibited in EU due to consumer protection and data protection rules.

Product Catalog

The central repository of all available services, products, variants, options and pricing available to the customer to purchase. Catalogs for cloud services are most of the time tailor-made, but there is some classic PDM solutions (Product Data Management, a.k.a. PIM for Product Information Management) out there that might fit the bill.

Calculator

Simulate a virtual invoice depending on the resource you plan to use.

  • Cloudorado - A comparison matrix which use ECU (Amazon's vCPU) as a CPU power measure unit.

  • EC2Instances.info - Easy Amazon EC2 Instance Comparison.

Cost Forecast

Help your customers predict their upcoming and future consumption based on their past usage.

  • Forecasting: Principles and Practice - “Comprehensive introduction to forecasting methods and to present enough information about each method for readers to be able to use them sensibly.”

  • [Transforming Financial Forecasting with Data Science and Machine Learning at Uber](https://web.archive.org/web/20221203184815/https://www.uber.com/blog/transforming-financial-forecasting-machine-learning/) - Discusses how Uber apply data science and machine learning in their financial planning platforms.

  • Time Series Prediction - A short introduction for pragmatists - Great introduction on how time series can be used to evaluate business problems.

  • Forecasting with sktime - A more detailed tutorial on how to use past data to make temporal forward predictions. And be aware of the differences between sktime and the Prophet project mentioned in the article above.

  • Darts - Python library for user-friendly forecasting and anomaly detection on time series. It wraps a huge number of models, including Prophet. Great for experiments, but bear in mind that all the models in Darts expects that your data comes at a very regular interval, and make a lot of assumptions about their shape.

  • Komiser - Open-source tool to stay under budget by uncovering hidden costs, monitoring increases in spend, and making impactful changes based on custom recommendations.

  • GCP Cost Forecast - An example of consumption trend line for resource consumption.

  • AWS Forecast - A full-featured hosted product to perform forecasting on any time-series.

  • How to save money on your AWS bill - “The biggest cost savings there are: 1. Turning things off that you're not using; 2. Then spot instances; 3. Then reserved instances.”

Marketplace

A marketplace connect supply with demand that lead to a financial transaction. If there is no payment involved, then it is an aggregator, or a hub. Not a marketplace.

Cloud Resources

This sub-section focus on bid/ask mechanism matching resource producer with consumers. Most of the time these are one-sided markets with the big platform trying to amortized under-utilized inventory.

  • Incentive Engineering for Computational Resource Management - Paper exploring the “mechanisms for the allocation of processor time and storage that are compatible both with programming practice and with market mechanisms.”

  • Pricing of Service in Clouds: Optimal Response and Strategic Interactions - “How should the consumer modulate its demand to optimize its profits? (…) How should the provider and consumer negotiate the specific pricing structure they will employ?” Covers non-linear models, tiered pricing, elastic demand, consumer et provider strategies.

  • History of Spot Instances - From AWS's original auction-based market (2009-2017) to provider-managed pricing across all major clouds today. Documents how transparent bidding was replaced by opaque algorithms.

  • Dynamic Cloud Pricing for Revenue Maximization - “Amazon's spot price is unlikely to be set according to market supply and demand. Rather, price oscillates within a very narrow band most of the time, which is more likely to be an artifact of some pricing algorithm with predetermined reserve price.”

  • [Usage Patterns and the Economics of the Public Cloud](https://mc4f.ee/Papers/PDF/EconPublicCloud.pdf) - “We examine the economics of demand and supply in cloud computing. (…) These results explain why fixed prices currently prevail despite the seeming need for time-varying dynamics. Examining the actual CPU utilization provides a lens into the future. (…) demand fluctuations would be on par with the three classic industries where dynamic pricing is important (hotels, electricity, airlines) and dynamic prices would be essential for efficiency.”

  • Maximizing Profit of Cloud Brokers under Quantized Billing Cycles: a Dynamic Pricing Strategy based on Ski-Rental Problem - “The key idea of our algorithms is to use pricing signal to regulate user demand. One may argue that such an algorithm gives poor service to the user as it pushes tasks out of the queue in order to maximize cloud broker's profit.”

  • Present or Future: Optimal Pricing for Spot Instances - “Pricing policy of spot resources should be carefully designed and the impact on both present and future should be considered.”

  • “You always pay the spot market price, not your bid.” (source) - Simple explanation of the bidding mechanism.

  • Deconstructing Amazon EC2 Spot Instance Pricing - “Cloud providers possessing large quantities of spare capacity must either incentivize clients to purchase it or suffer losses. Amazon is the first cloud provider to address this challenge, by allowing clients to bid on spare capacity and by granting resources to bidders while their bids exceed a periodically changing spot price.”

  • GCP Preemptible VMs vs AWS Spot Instances - “Google's prices are fixed, whereas AWS uses a market model”.

  • “Look at the 3-month spot price history to estimate cost and to discover combinations of availability zone and instance type with extra capacity.” (source) - Users are seeking more transparency on the spot market.

  • The Eternal Cost Savings Of Netflix's Internal Spot Market - When you're big enough that creating an internal secondary market for instances makes economic sense.

  • AutoSpotting - Tool that easily and reliably converts (all) your existing AutoScaling groups to cheaper spot instances.

Online Ads

Targeted online advertisements marketplaces have a lot in common with traditional cloud marketplace. Some good inspiration there, from concepts to tech.

Accounting

  • “The Accounting department is usually backwards facing. The Finance department is usually forwards facing.” (source)

Double-Entry Model

The core concept of accounting is double-entry. It is the most critical part to grasp in order to properly design any robust system that tracks money.

Bookkeeping

Everything you need to know about the daily practice of keeping your accounting data clean and tidy.

  • So, you want to learn Bookkeeping! - Focus on the daily operations of recording and maintaining the transactions of a business.

  • Reconciliation: A game designed to frustrate the player - “Reconciliation is a business process which arises almost entirely because of a lack of structured data in the pipelines that convey money between businesses”. There are some hack to streamline the process, like adding an arbitrary discount to produce unique trailing decimals, or setup a couple of virtual bank accounts as proxy.

  • Plain text accounting tools - Extensive list of open-source personal finance projects that might be great to look into for inspiration on double-entry accounting and bookkeeping.

  • And a list of graphical accounting tools: GNUCash (GTK+), Grisbi (C), Firefly III (PHP).

  • GnuCash Tutorial and Concepts Guide - A complete tutorial on personal finance tracking with GnuCash.

  • Frappe Books - Free Desktop book-keeping software for small-businesses and freelancers.

  • Luca - YAML accounting and JSON tax forms.

  • Sequence - API that store, validate and reports asset movements. Also known as a Ledger. Sequence is immutable, scalable, and easy to use.

  • Go DB Ledger - An open source accounting system that aims to make the recording of double entry bookkeeping transactions programmable.

  • Ledger - A scriptable financial ledger, designed to make it easy to model complex financial transactions.

  • Akaunting - Open source software designed for small businesses and freelancers.

Software design and implementation

Now that you're somewhat familiar with the concepts and practice of accounting, here are some resources to help you implement that knowledge into software systems.

  • Moonpig: a billing system that doesn't suck - Design decisions behind a billing and accounting system. Key takeaway: some companies still pays by checks; do not use floats; complex customer workflows; date and time issues; mutable data.

  • [Books, an immutable double-entry accounting database service](https://developer.squareup.com/blog/books-an-immutable-double-entry-accounting-database-service/) - Explain the basic data model of a double-entry accounting system relying on Google Spanner for internal use at Square.

  • TigerBeetle - A distributed financial accounting database to ensure that the money either moves, or doesn't move, that it doesn't get lost somewhere in between. It has been tested on Jepsen, which tested its strong serializability.

  • Django Hordak - Core functionality of a double entry accounting system for Django.

  • Managed accounts for Django - A 'managed account' is an allocation of money that can be debited and credited.

  • Triple‐entry accounting with Blockchain: How far have we come? - “Triple‐entry accounting is a new and a more efficient way to address fundamental trust and transparency issues that plague current accounting systems. Triple‐entry accounting with Blockchain, when properly implemented, can fundamentally improve accounting.”

Currencies

Global companies needs to know how to juggle between local currencies.

Finance

Once you've got your accounts in order, you can start extracting insights and metrics from your financial data.

Contracts

All the invoicing terms & conditions are materialzed by the contract signed between the end-user and the service provider. That's the source from where we derives all the rules of the billing cycle.

  • Is this what Enterprise mean? - When contracts, invoicing and payments are not working together, you end up alienating your big enterprise customers. See the associated HN comments on bulk license purchase.

  • Entitlements untangled: The modern way to software monetization - “The concept of Entitlements encapsulates the feature access settings under various product variants (aka Pricing Plans or Packages), bridging the gap between how a product is sold and how it behaves for a variant. In essence, entitlements are a set of permissions defining what a customer (paying or non-paying) can do with your software application.”

  • CUDs vs. Commit Contracts vs. SUDs in Google Cloud - Explains the differences between various types of discounts and usage commitments in GCP.

  • Quantity discounts on a virtual good: The results of a massive pricing experiment - “Implementing price reductions ranging from 9–70% for large purchases, we found remarkably little impact on revenue, either positively or negatively.” If discounts are a placebo and are still widely used in the industry, maybe they are a marketing hack to lure big customers?

  • “It used to be I could just give a lump sum and let Google Ads play until there is no more budget. Not anymore.” - (source) - Google Ads used to implement a concept of capped actuals. A kind of monthly budget with rollover, which is an optimal billing scheme to limit surprises for customers. It always looked to me as a way to sell quotas.

Coupons and Vouchers

Taxes

European VAT

Invoice

The invoice materialize a consumed service or purchased product, waiting to be settled by a payment transaction.

  • On GCP invoiced billing - Invoiced billing is a B2B-friendly payment happening after the service is consumed and an invoice issued. It seems to be a pain to setup on GCP but I suspect is a consequence of trying to reduce (costly) fraud.

Structure

  • Content of EU invoices - The information required on a EU invoice is detailed by Article 226, Section 4 (Content of invoices) of Council Directive 2006/112/EC on the common system of VAT.

Integrity

Once issued, an invoice must be immutable.

Generators

  • Manta - Flexible invoicing desktop app with beautiful & customizable templates.

  • InvoicePlane - A self-hosted open-source application for managing your invoices, clients and payments.

  • InvoiceGenerator - Library to generate a simple invoices.

  • Ruby Invoicing Framework - For generating and displaying invoices (ideal for commercial Rails apps). It allows for flexible business logic; provides tools for tax handling, commission calculation etc.

  • klirr - Zero-maintenance and smart FOSS CLI tool for generating beautiful invoices for services and expenses.

Extractors

  • InvoiceNet - Deep neural network to extract intelligent information from invoice documents.

Electronic invoices

  • [Invoice Security Vulnerabilities](https://invoice.secvuln.info) - European Union introduced a "standard" in XML format, which comes with a set of security vulnerabilities.

  • EU eInvoicing - European standard on electronic invoice.

  • Factur-X - Python library to support the e-invoicing standard for France and Germany.

  • Universal Business Language - Most invoicing software can read and write UBL documents (XML) for data transfer.

  • GOBL - JSON Schema, Open Source Go library, global tax database, with conversion tools, all in one.

Payments

Receipt

A receipt materialize the payment transaction.

Credit Cards

The most popular payment device.

Bank Accounts

The old-fashioned way of payment: by the way of banks.


truncated — full list on GitHub

[[curator]]
I'm the Curator. I can help you navigate, organize, and curate this wiki. What would you like to do?