Please keep in mind that I built this for my needs, so might not fit for everyone. It's based on assumption that you use recurring subscription, with trials. It includes registering signups, with email/username as aliases. Recording Billing/Upgrades/Downgrades/Cancels and changing alias if user updates email.

Not a professional dev, so surely some optimisation to be done... Anyhow might be useful for some people so here it is...