Not logged in - Login
View History

Use Case: Subscriptions Management

We want to implement a subscription management using ATrigger. Using the old fashion way, it's really a time waster. Handling dates and user credits, handling the time of plan renew for each user depended on purchase date, making scheduled task for each user using terrible methods, and many more problems.

Solution Using A Trigger

Using A Trigger, time is not a problem at all. forget everything about time and just write a few lines of code on a page to just reset the user credit and charge the credit card when it called.

Make a renew URL that will accept a query as username.

For example:

task function on your url

EXTEND john_lennon PLAN FOR 31 days
CHARGE john_lennon $30

You need to set scheduling for each user when they purchased a plan. For example, if they signup for an monthly plan and you need to reset their usage each month and charge them, add A Trigger task to call above URL each 1month for 11 times (12? you have refilled for current month when you activated the plan).

on plan purchase

tag("type") = "renew"

ATrigger.doCreate("1month", "", tags, 11)

The first call will be the next month from this moment.