recurring payment #29

Closed
opened 2022-07-04 06:02:31 +00:00 by dachary · 7 comments

the payment must be set to be monthly instead of one shot

the payment must be set to be monthly instead of one shot
realaravinth self-assigned this 2022-07-04 06:14:41 +00:00

It is difficult to implement this feature within the MVP timeframe. I couldn't find any documentation related to recurring payments in django-payments docs, so I'll either have to write Stripe code myself or set up a cron job --- both difficult to implement within MVP timeframe.

That said, the primitives for setting up monthly payments exist within the Dashboard.

It is difficult to implement this feature within the MVP timeframe. I couldn't find any documentation related to recurring payments in `django-payments` docs, so I'll either have to write Stripe code myself or set up a cron job --- both difficult to implement within MVP timeframe. That said, the primitives for setting up monthly payments exist within the Dashboard.
Poster
Owner

Can't Stripe be instructed to do monthly payment, even if django-payment is unaware? Not having recurring payment is going to be problematic very quickly.

Not having feedback about recurring payment on the dashboard is less problematic: the customer will see the amounts are withdrawn monthly. And if the Gitea instance is terminated and django-payment does not know how to cancel a recurring payment, it can be done manually.

A contrario, requiring the users to make payment monthly will be inconvenient to them and it will also require work on the dashboard because it will be necessary to implement a "renew" workflow in addition to the "create" workflow that already exists.

What do you think?

Can't Stripe be instructed to do monthly payment, even if django-payment is unaware? Not having recurring payment is going to be problematic very quickly. Not having feedback about recurring payment on the dashboard is less problematic: the customer will see the amounts are withdrawn monthly. And if the Gitea instance is terminated and django-payment does not know how to cancel a recurring payment, it can be done manually. A contrario, requiring the users to make payment monthly will be inconvenient to them and it will also require work on the dashboard because it will be necessary to implement a "renew" workflow in addition to the "create" workflow that already exists. What do you think?

Stripe does support recurring payments but instructing stripe is implemented within django-payments. I estimate I will require at least two more weeks to setup recurring payments.

I found a related issue on django-payments and it looks like it will be a while before the library will have support for recurring payments.

A contrario, requiring the users to make payment monthly will be inconvenient to them

Agreed

and it will also require work on the dashboard because it will be necessary to implement a "renew" workflow in addition to the "create" workflow that already exists.

The primitives to generate invoices for a billing cycle exist in the Dashboard. The easiest way to support recurring payments within the MVP timeframe will be implementing a management command, which can be scheduled to run on a daily basis using cronjob.

The command will:

  1. iterate over all instances
  2. see if the billing cycle is paid for:
    • if yes, do nothing
    • if no:
      i) Generate invoice, if one doesn't exist and send email reminder
      ii) Compute overdue period and compare with overdue period tolerance(how late is late enough to terminate instance) and terminate if beyond tolerance
Stripe does support recurring payments but instructing stripe is implemented within `django-payments`. I estimate I will require at least two more weeks to setup recurring payments. I found a related issue on [`django-payments`](https://github.com/jazzband/django-payments/issues/59) and it looks like it will be a while before the library will have support for recurring payments. > A contrario, requiring the users to make payment monthly will be inconvenient to them Agreed > and it will also require work on the dashboard because it will be necessary to implement a "renew" workflow in addition to the "create" workflow that already exists. The primitives to generate invoices for a billing cycle exist in the Dashboard. The easiest way to support recurring payments within the MVP timeframe will be implementing a management command, which can be scheduled to run on a daily basis using cronjob. The command will: 1. iterate over all instances 2. see if the billing cycle is paid for: - if yes, do nothing - if no: i) Generate invoice, if one doesn't exist and send email reminder ii) Compute overdue period and compare with overdue period tolerance(how late is late enough to terminate instance) and terminate if beyond tolerance
Poster
Owner

I found a related issue on django-payments and it looks like it will be a while before the library will have support for recurring payments.

Good find. And indeed, looks like it is non trivial.

IIRC https://git.cyberia.club/cyberia/capsul-flask/ implements recuring payment and has support for stripe.

> I found a related issue on django-payments and it looks like it will be a while before the library will have support for recurring payments. Good find. And indeed, looks like it is non trivial. IIRC https://git.cyberia.club/cyberia/capsul-flask/ implements recuring payment and has support for stripe.
Poster
Owner

Ah, no it does not. It provisions in advance which is a simple workaround.

Ah, no [it does not](https://git.cyberia.club/cyberia/capsul-flask/src/branch/main/capsulflask/payment.py#L183). It provisions in advance which is a simple workaround.
Poster
Owner

The easiest way to support recurring payments within the MVP timeframe will be implementing a management command, which can be scheduled to run on a daily basis using cronjob.

Sound good to me.

> The easiest way to support recurring payments within the MVP timeframe will be implementing a management command, which can be scheduled to run on a daily basis using cronjob. Sound good to me.
realaravinth started working 2022-07-04 13:19:40 +00:00
realaravinth stopped working 2022-07-04 13:44:48 +00:00
25min 8s
realaravinth started working 2022-07-05 03:58:49 +00:00
realaravinth stopped working 2022-07-05 04:29:04 +00:00
30min 15s
realaravinth started working 2022-07-07 12:03:14 +00:00
realaravinth stopped working 2022-07-07 14:02:06 +00:00
1h 58min 52s
realaravinth started working 2022-07-07 14:15:41 +00:00
realaravinth cancelled time tracking 2022-07-07 15:22:41 +00:00
realaravinth added spent time 2022-07-07 15:22:56 +00:00
30min
realaravinth added spent time 2022-07-07 20:22:27 +00:00
2h
python manage.py generate_invoice

Generates invoices for VMs which enter a new billing cycle and sends notification email to VM owners.

This command can be run as many times as desirable but running at least once in a day is advisable.

Documentation and minimal tests are included.

```bash python manage.py generate_invoice ``` Generates invoices for VMs which enter a new billing cycle and sends notification email to VM owners. This command can be run as many times as desirable but running at least once in a day is advisable. Documentation and minimal tests are included.
Sign in to join this conversation.
No Label
No Milestone
No project
No Assignees
2 Participants
Notifications
Total Time Spent: 5 hours 24 minutes
realaravinth
5 hours 24 minutes
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: Hostea/dashboard#29
There is no content yet.