We are at the planning stage of a web application offering a subscription to our customers. Subscription periods vary and can be extended indefinitely by our customers, but always at least one month (30 days).
When a customer subscribes, customer information (billing address, phone number, etc.) is stored in the customers table, and a subscription is created in the subscriptions table:
id | start_date | end_date | customer_id -------------------------------------------------------- 1 | 2010-12-31 | 2011-01-31 | 1
Every month we will sort through the subscriptions table (preferably a cronjob) and create invoices for the last subscription period, which are placed in their own table - invoices . Depending on the client, invoices are printed out manually and sent by mail or simply sent to the client by e-mail.
Due to the nature of our customers and the product, we need to offer various payment options, including bank transfer and card payments, so some invoices may need to be manually processed and registered, paid by our employees.
On the 15th every month, the invoices table invoices looped, and if no payment has been marked for the actual invoice, the corresponding subscription will be deleted. If a payment is registered, end_date in the subscriptions table increases for another 30 days (or for which period our client is selected).
Are we looking for headaches, increasing dates back and forth to handle insolvent customers and expand subscriptions? Would it be better to add new subscriptions as customers expand their subscription?
mysql logic subscription invoices
Industrial
source share