The Deposit Plugin is a Kill Bill payment plugin that lets you record offline payments, such as wire transfers or checks, against specific Kill Bill invoices.
Prerequisites
-
Ensure that you have Kill Bill, Kaui, and the database set up as explained in the Getting Started Guide.
-
Ensure that you have cURL installed. If you are on Windows, we recommend that you use Git Bash to run the
cURLcommands.
Overview
The Deposit plugin allows you to record payments that are received outside a payment gateway, for example a bank wire or a check. When a deposit is recorded, the plugin creates a payment in Kill Bill for each invoice it covers, which reduces the invoice balance just like any other payment.
The plugin provides the following features:
-
An API to record a single deposit against one or more invoices
-
Storage of the deposit details (reference number, deposit type and effective date) along with each payment
-
An optional minimum payment amount per currency
How it Works
For developers, the Deposit plugin is implemented as both a Kill Bill Payment Plugin and a Kill Bill Payment Control Plugin.
Execution Flow
-
The client invokes the plugin’s
/recordendpoint with the account, the deposit details, and the list of invoices to pay. -
The plugin looks up the account and its
killbill-depositpayment method. If the account does not have one, the plugin creates it. This payment method is not set as the account’s default. -
For each invoice in the request, the plugin creates a purchase payment against the invoice using the
killbill-depositpayment method, with the deposit effective date as the payment date. -
Kill Bill runs its standard invoice payment checks. If enabled, the Deposit payment control plugin also checks the payment against the configured minimum amount.
-
The plugin saves the deposit details and marks the payment as processed. Kill Bill then applies the payment to the invoice.
Field Mapping
Here is how the deposit fields map to Kill Bill:
-
paymentReferenceNumber → Payment transaction
firstPaymentReferenceId(also stored as thedepositPaymentReferenceNumberplugin property) -
depositType →
depositTypeplugin property on the payment transaction -
effectiveDate → Payment effective date (also stored as the
depositEffectiveDateplugin property)
Plugin Installation
The Deposit plugin can easily be installed via the Aviate UI. Refer to this doc for a detailed demo.
Alternatively, the plugin can also be installed via Kaui or KPM as explained in the Plugin Installation Guide.
For example, to install the plugin via KPM, you can run the following command:
kpm install_java_plugin deposit --destination=<path_to_install_plugin>
Database Configuration
The Deposit plugin requires some additional database tables. To create these tables, please follow the steps given below:
-
Connect to the Kill Bill database.
-
Run the Deposit Plugin DDL. If you are using PostgreSQL, also run the PostgreSQL DDL instead.
Plugin Configuration
The Deposit plugin does not require any configuration to record deposits.
Optionally, the plugin can enforce a minimum payment amount per currency. The minimum is checked separately for each invoice payment, not against the total deposit amount. Setting this up involves two steps:
Enabling the Payment Control Plugin
The minimum amount is enforced by the Deposit payment control plugin, which is enabled via the org.killbill.payment.invoice.plugin property. This property can be set globally or on a per-tenant basis.
To enable the plugin globally (for all tenants), set the following property in the Kill Bill Configuration File:
org.killbill.payment.invoice.plugin=killbill-deposit
To enable the plugin for a specific tenant, set the property as a per-tenant property. This can easily be done via the Aviate UI by navigating to the Settings tab in the left nav. Alternatively, you can invoke the uploadPerTenantConfig endpoint. For example, to enable the plugin for the bob/lazar tenant, you can use the following curl:
curl -v \
-X POST \
-u admin:password \
-H 'X-Killbill-ApiKey: bob' \
-H 'X-Killbill-ApiSecret: lazar' \
-H 'X-Killbill-CreatedBy: admin' \
-H 'Content-Type: text/plain' \
-d '{"org.killbill.payment.invoice.plugin":"killbill-deposit"}' \
http://127.0.0.1:8080/1.0/kb/tenants/uploadPerTenantConfig
|
Note
|
|
Configuring Minimum Amounts
The minimum amounts are configured via the following property:
| Property Name | Description | Required | Default Value |
|---|---|---|---|
minAmounts |
Minimum payment amount for each currency, specified as |
No |
- |
Alternatively, the minimum amounts can be configured via the Add a per-tenant configuration for a plugin endpoint. For example, to set a minimum amount of 0.5 USD for the bob/lazar tenant, you can use the following curl:
curl -v \
-X POST \
-u admin:password \
-H 'X-Killbill-ApiKey: bob' \
-H 'X-Killbill-ApiSecret: lazar' \
-H 'X-Killbill-CreatedBy: admin' \
-H 'Content-Type: text/plain' \
-d '!!org.killbill.billing.plugin.deposit.DepositConfiguration
minAmounts:
USD: 0.5' \
http://127.0.0.1:8080/1.0/kb/tenants/uploadPluginConfig/killbill-deposit
Expected result: HTTP 201/204 and no validation errors in the response.
Kaui Integration
A Deposit UI is available in Kaui once the Deposit plugin is installed. It allows you to record deposits against the invoices of an account and can be accessed by clicking the "Create Deposit" button on the account page. Refer to the Kaui Guide for further details.
Recording a Deposit
This API can be used to record a deposit against one or more invoices of an account. It accepts the following fields:
| Field | Description | Required |
|---|---|---|
accountId |
Id of the Kill Bill account that made the deposit. |
Yes |
effectiveDate |
Date on which the deposit was received, for example |
Yes |
paymentReferenceNumber |
Reference of the deposit, for example the wire or check number. |
Yes |
depositType |
Type of the deposit, for example |
Yes |
payments |
List of invoices to pay. Each entry specifies the |
Yes |
For example:
curl -v \
-X POST \
-u admin:password \
-H 'X-Killbill-ApiKey: bob' \
-H 'X-Killbill-ApiSecret: lazar' \
-H 'X-Killbill-CreatedBy: admin' \
-H 'Content-Type: application/json' \
-H 'Accept: application/json' \
-d '{
"accountId": "<ACCOUNT_ID>",
"effectiveDate": "2026-11-05",
"paymentReferenceNumber": "WIRE-12345",
"depositType": "wire",
"payments": [
{
"invoiceNumber": 824,
"paymentAmount": 100.00
}
]
}' \
http://127.0.0.1:8080/plugins/killbill-deposit/record
If successful, it returns a status code of 201. Otherwise, it returns one of the following status codes:
| Status Code | Reason |
|---|---|
|
The |
|
The account or one of the invoices does not exist. |
|
Kill Bill or the Deposit payment control plugin aborted the payment. For example, the invoice is not committed, the invoice is already paid, or the amount is below the configured minimum amount. |
|
Any other error, for example a payment amount that is greater than the invoice balance. |
|
Note
|
Entries with a missing or zero paymentAmount are skipped. Invoices are processed in the order specified in the request, and processing stops at the first error. Payments recorded for the invoices before the failing invoice are not rolled back.
|
Partial Payments, Overpayments, Refund
Partial Payments:
If the paymentAmount is less than the invoice balance, the payment is applied and the invoice remains unpaid with the remaining balance. Subsequent deposits can be recorded against the same invoice until it is fully paid.
Overpayments:
Kill Bill does not allow a payment greater than the invoice balance. In order to record an overpayment, follow the steps given below:
-
Retrieve the invoice to obtain its balance.
-
Record a deposit for the invoice balance as explained in the Recording a Deposit section above.
-
Create a credit on the account for the remaining amount. The credit is automatically applied to future invoices.
Refunds:
The Deposit plugin only supports purchase payment transactions. The plugin does not support refund, credit and void payment transactions, so you must handle any associated movement of funds externally. Account credits, such as those described in the overpayment workflow above, can still be created in Kill Bill.
Testing the Plugin
Once the plugin is installed, you can use it to record offline payments against Kill Bill invoices. You can follow the steps given below to test the plugin:
-
Ensure that the plugin is installed as explained above.
-
Create a Kill Bill account. Save the accountId for further use.
-
Create an external charge of
500USD on the account withautoCommit=true. Save the invoiceNumber of the generated invoice for further use. -
Record a deposit of
100USD against the invoice as explained in the Recording a Deposit section above.Expected result: HTTP
201. -
✅ Expected Result: The invoice balance is reduced to
400USD. In Kaui, the account’s payments include a payment for100USD made with thekillbill-depositpayment method.