Using Stripe's 'invoice.upcoming' webhook to send an email?

Hey guys,

Seems like the only option for reminder-emails offered by s2M is to send an email about upcoming EOT, which doesn’t work for recurring subscriptions…

As per title, as far as I can tell, that leaves me working with the API event ‘invoice.upcoming’ from Stripe to get an email to customers letting them know they’re about to be billed for their next subscription period.

I’m roughly familiar with basic PHP and API calls but doing some head-scratching here:

  • Is this achievable through s2M at all?
  • If not, how/should I use the existing webhook URL https://siteurl/?s2member_pro_stripe_notify=1, rather than creating a new one?
  • Is this even the right process to do what I want to do?!

There’s info here that follows roughly what I want to achieve (but with a different event trigger and differently worded email) although it uses Composer.

Has anyone had success with something similar? Or can point me in the right direction? Thanks!

Hi Tom, I would do that way: would check if the URL you show gets the need info to identify the Stripe’s hook. If so, I would run a procedure prior to s2M’s answer, maybe in the “init” hook of WP, would send email and would stop the process (to not run s2M code). Well, not much explanation, but hope you understand the idea.

Thanks Krum,

I don’t understand why we want to stop the process to avoid s2M code? This is an API ‘event’ that does not have any response from s2M. The event is only to tell us that a user will have their membership renewed soon.

The client is not sure if she wants to send these emails. If she decides, may I contact you on your TDL to ask about a quote? My PHP is not as good as yours!

Count logically, there is no strict need to stop the process, as this event is “no mean” for s2M and it will do nothing. But this means that s2M will need to run and compile too, stopping saves server’s time… Well, not much, but I am “trained” to speed up the sites :slight_smile:

You are welcome with any task :slight_smile:

Hi Tom,
You could also take a look at this tutorial from Pippin Williamson:


Take a close look at part 6 where he talks about web hooks and how to use that with Stripe.
The tutorial is a bit old (2012) but I believe the code still works.

Thanks Toon,

I actually came across this in googling and thought it looked useful.

Now I’m considering Pippin’s Restrict Content Pro as a successor to s2Member! Full circle. Anyway the client has let go of this idea so I’m off the…hook…pardon the pun.