1

I am looking into building a simple subscription site for a project. The subscription will be a physical product that people will get delivered to their door.

I am going to use Stripe and Laravel to build it as there is a really nice package that has just been released for Stripe with Laravel here https://github.com/laravel/cashier

I have been looking at Laravel and this package and Stripe and I cannot find anything that would allow you to send an email to a user (registered of course) saying 'you did not buy that subscription when you clicked on it'.

Would it be possible to do this with in Laravel notifications at all?

halfer
  • 19,824
  • 17
  • 99
  • 186
M dunbavan
  • 1,157
  • 5
  • 22
  • 57
  • Not familiar with Laravel, but I am sure it will be possible. Most modern frameworks allow you to do anything that can be done in a web user interface. – halfer Mar 07 '14 at 12:28
  • Maybe you should check to the event system of laravel http://laravel.com/docs/events – KeizerBridge Mar 07 '14 at 14:17

2 Answers2

1

I'm erasing my previous answer (recommending using mailchimp/Mandrill) after finding something in the documentation in Laravel I hadn't seen before.

Laravel has a queuing system built that using Carbon can delay the email send so it becomes pretty easy once you've created the email that you'd like to send.

protected function queueReminder($message, $delay)
   {
      $date = Carbon::now()->addMinutes($delay);
      $reminder = Queue::later($date, 'SendEmail@send', array('message' => $message));
      Session::put('reminder', $reminder);

      Return True;
   }

Then when they make their purchase go back and cancel the email with:

 protected function destroyReminder()
   {
      return $reminder->getJobId(Session::get('reminder'))->delete();  
   }

And that should do it ... I haven't tried it, but I hope it works!

cfkane
  • 643
  • 1
  • 6
  • 16
0

I am not familiar with the Stripe package but I would consider doing this:

  • when something is dropped in the cart, make an entry in #_cart_tmp table with uid, cart_id, notified (to mark if has received reminder email) or whatever might make the follow up process easier
  • when paid, remove it
  • run a cron every 90', checking this table and sending emails accordingly.

The only alternative would be a JavaScript timeout function which of course is not sufficient and will not run if the user is not connected.

Community
  • 1
  • 1
alou
  • 1,432
  • 13
  • 16