---
title: Deploy Kill Bill with AI on Blossom
url: "/deploy/kill-bill/"
canonical_url: https://blossom88.com/deploy/kill-bill/
markdown_url: https://blossom88.com/deploy/kill-bill.md
summary: Run Kill Bill and its Kaui dashboard with managed MySQL, then verify a recurring
  invoice without charging a card.
categories:
- deployment
- billing
stack:
- Java
- Ruby on Rails
- MySQL
---

# Deploy Kill Bill with AI on Blossom

[Kill Bill](https://killbill.io/) is an open-source billing API for managing
subscriptions and generating invoices. Its Kaui dashboard lets you inspect
what a customer owes before connecting a payment provider.

## Ask Your Agent

> **Ask your AI agent:** Deploy Kill Bill and Kaui on Blossom with managed MySQL. Help me create a test subscription and verify an unpaid invoice.
>
> Follow this guide: https://blossom88.com/deploy/kill-bill/

[Install the Blossom CLI and skill](https://docs.blossom88.com/learn/getting-started/install/) on your agent's machine and [choose a Location in your cloud account](https://docs.blossom88.com/learn/getting-started/choose-your-cloud/#connect-your-provider).

## Have Ready

- **Managed MySQL** (Required): Two empty MySQL 8.4 databases with separate credentials, one for Kill Bill and one for Kaui.

## How It Runs

| Part | Role | Where |
|---|---|---|
| Kill Bill | Track subscriptions and calculate invoices | Private Service |
| Kaui | Manage billing accounts, plans, and invoices | Web Service with Blossom Account access |
| MySQL | Keep billing records and Kaui tenant configuration | Two Blossom Managed Data instances |

## Deploy Kill Bill and Kaui

Give each Service its own managed MySQL database. Use private networking
for the API and Blossom Account access for Kaui.

<details class="optional-reading" markdown="1">
<summary>Notes for your agent</summary>

The setup uses Kill Bill 0.24.22 and Kaui 4.0.31. The bootstrap bundles
contain the matching release schemas under the [Kill Bill Apache license](/deploy/recipes/kill-bill/KILLBILL-LICENSE.txt)
and the [Kaui MIT license](/deploy/recipes/kill-bill/KAUI-LICENSE.txt).
The Kill Bill bundle removes the test snapshot's table-deletion statements.

Use the matching versioned Kill Bill and Kaui images. Choose the Kill Bill
image as the Environment source and the Kaui image for the web Service.

Link the databases as `KILLBILL_MYSQL_URL` and `KAUI_MYSQL_URL`. Run the
[Kill Bill schema job](/deploy/recipes/kill-bill/killbill-schema-job.json)
and the [Kaui schema job](/deploy/recipes/kill-bill/kaui-schema-job.json)
with their corresponding Links. Each initializes an empty database.

Start both Services with the [runtime script](/deploy/recipes/kill-bill/launcher-runtime.py),
passing `api` to the API Service and `web` to Kaui. Set
`KAUI_KILLBILL_URL` to the API's private URL on port 8080. Keep the
administrator password, Kaui session secret, and Kaui tenant encryption
key and IV in protected Environment variables. Keep them stable across
deploys so Kaui can read its stored tenant credentials.

</details>

<details class="optional-reading" markdown="1">
<summary>Commands your agent runs</summary>

    blossom app_plan:preview --data kill-bill-plan.yml
    blossom database_instance:create --data kill-bill-db.yml
    blossom database_instance:create --data kaui-db.yml
    blossom app:create --data kill-bill-app.yml
    blossom environment:create --data kill-bill-environment.yml
    blossom environment_link:create --data kill-bill-link.yml
    blossom environment_link:create --data kaui-link.yml
    blossom job:run:create --environment environment-100 --data killbill-schema-job.json --follow
    blossom job:run:create --environment environment-100 --data kaui-schema-job.json --follow
    blossom service:create --data kill-bill-api.yml
    blossom service:create --data kaui-web.yml
    blossom env_var:push --environment environment-100 --file private.env
    blossom environment:deploy --id environment-100 --follow

</details>

## Set Up a Test Billing Tenant

Create a sample tenant through the private Kill Bill API. Register it in
Kaui and give it a simple USD 18 monthly plan so you have a known amount
to check on the invoice.

> **Ask your AI agent:** Set up a test billing tenant in Kill Bill, connect it to Kaui, and add a sample $18 monthly plan.

> Follow this guide: https://blossom88.com/deploy/kill-bill/



## Create an Unpaid Test Invoice

Add a sample customer without a payment method and turn off automatic
payment before creating its subscription. Check the $18 recurring line
and the $18 outstanding balance in Kaui.

![Open the sample billing account in Kaui.](/deploy/assets/images/kill-bill/kill-bill-sample-account.webp)

> **Ask your AI agent:** Create a sample monthly subscription in Kill Bill with automatic payment disabled. Show me the unpaid invoice in Kaui.

> Follow this guide: https://blossom88.com/deploy/kill-bill/



## Keep It Running

Keep both MySQL Links and the same Kaui encryption settings across
redeploys. In your test Environment, replace both Containers, sign in to
Kaui again, and reopen the original invoice.

![Reopen the same unpaid recurring invoice.](/deploy/assets/images/kill-bill/kill-bill-unpaid-invoice.webp)


> **Ask your AI agent:** Replace the Kill Bill and Kaui Containers, then sign in to Kaui and reopen the same unpaid invoice.

> Follow this guide: https://blossom88.com/deploy/kill-bill/



## What You Get

- A private Kill Bill API and a Kaui dashboard with Blossom Account access
- A sample customer on a monthly billing plan
- An invoice in Kaui showing the recurring line and unpaid balance
- Billing records you can reopen after replacing the app Containers

Tested on Blossom: A fresh Kaui sign-in reopened the same unpaid $18 invoice after both Containers were replaced.
