bpuig / laravel-subby

Laravel Plan and Subscriptions manager.
https://bpuig.github.io/laravel-subby
MIT License
104 stars 42 forks source link

Handle renewal, schedule and payment #112

Closed bpuig closed 2 years ago

bpuig commented 2 years ago

Status

READY

Migrations

YES

Description

New services and jobs to process pending renewals and also schedules.

Todos

Deploy Notes

Publish dev migrations.

Impacted Areas in Application

List general components of the application that this PR will affect:

boryn commented 2 years ago

Hi @bpuig!

I can see lots of new things coming in the v6 :)

What payment provider do you work with that you need to manually, periodically trigger the payment? I used to work with payment providers where we process the first payment with the option of recurring payments, and later it's them who trigger a webhook at our system, and we know whether the consecutive payments were successful or not and change the plan subscription accordingly.

PS. If you could remember about https://github.com/bpuig/laravel-subby/issues/80 and https://github.com/bpuig/laravel-subby/issues/90

bpuig commented 2 years ago

I can see lots of new things coming in the v6 :)

Yeah 😎

What payment provider do you work with that you need to manually, periodically trigger the payment?

Honestly, I can't think of any. I noticed that while I was doing it. I have a local bank provider that kinda looks like that. But I'll leave that as a base to start working on your own payment methods. It will be good for Free (for example you can set there to send an email to the client or something).

I used to work with payment providers where we process the first payment with the option of recurring payments, and later it's them who trigger a webhook at our system, and we know whether the consecutive payments were successful or not and change the plan subscription accordingly.

Yes, I think that is the way Stripe works. This can easily be achieved using null as payment_method. Subscription will become passive in means of what renews it.

PS. If you could remember about #80 and #90

I will, but I can only do things on weekends 😛

boryn commented 2 years ago

And the "free" plan will be then automatically renewed? You remember, we were talking about this as for me, the "free" should be just free and maintenance-free ;) Or we still need to run the scheduler to renew the free plan?

bpuig commented 2 years ago

And the "free" plan will be then automatically renewed?

"Automatically", yes. Just run the payment collector schedule and it will be renewed. The default service for "free" does nothing but renew.

You remember, we were talking about this as for me, the "free" should be just free and maintenance-free ;) Or we still need to run the scheduler to renew the free plan?

You need to run it because, one way or another, usage has to be reset. So the universal solution is a payment service that does nothing but renew.

Also note, this branch has many bugs now. Be careful.

bpuig commented 2 years ago

I¡m stupid and did not squash commits :man_facepalming: