Bill payment seems like a simple topic, but can broaden once you start considering the details.
The bill payment process at its simplest involves two data entities: an account (aka customer, client, etc.), and a ledger. The ledger records credits and debits to the customer's account. Debits are the invoices, and any document which increases a customer's balance. Credits are the payments and any document which decreases a customer's balance. There are exceptions to this, but lets keep it simple.
The sum of credits and debits are the customer's account balance.
One part of your system should be generating charges be they subscriptions, merchandise purchases, etc.
An example table structure is shown below:
Customer Table
Id Name Balance
1 Smith 1000.00
2 Jones 0.00
Ledger Table
Id CustomerId Type Description Amount
1 1 D Services for June '09 1000.00
2 2 D Subscription for Jul '09 50.00
3 2 C Payment MC ****2908 -50.00
Of course this is about as simple as you might want to get.
Here are some other things to consider.
Triggers on the tables can be used to keep the customer's balance in sync.
If you need to know what payments are applied to what invoices then you need an additional table.
Most larger and not-so-large accounting systems maintain two parts for this process: documents and ledgers.
The documents consist of entities such as Invoices, Credit Memos, Sales Receipts, Refunds, and Payments. There are others.
Depending on the document the ledger is impacted in different ways.
Invoices: charge a customer but do not collect money, it is due to you so there is only one ledger entry- a debit for the invoice amount
Credit Memos: credit a customer but do not refund the money, you owe it back so there is only one ledger entry- a credit for the credit memo amount
Sales Receipts: charge a customer and collect money, the net effect is to have zero balance due from this activity and so there are two ledger entries: a debit for the amount of the sale and a credit for the amount of the payment netting to zero.
Payments: record the collection of money from a customer therefore only one ledger entry- a credit for the payment amount.
I hope this addresses your quesetion. If not let me know as I have written about a dozen custom accounting systems throughout the years.