Working with discount coupons in Laravel Spark

** EDIT 2018/04/04: This is applicable to both Spark 6 and 5

**  EDIT 2018/10/19: This posts was made for Spark 5, but most likely it still perfectly applies to Spark . I’ve read the changelog and upgrade instructions, and those do not mention any changes regarding coupons. I’ll update this post once we upgrade to Spark 7.

A couple of days ago it was Black Friday and at publica.la we decided to put out a beefy discount for new customers. Thankfully we use Laravel Spark to handle all the SaaS boilerplate needed to bill our clients, but while it does offer full support for discount coupons… IMO the docs are a bit lacking. I even tweeted asking for help but, ironically, all I got was a response from a guy that though I was looking for a discount to actually buy Spark.

* I’m going to make the assumption that you’re using Stripe as the gateway, but Braintree should be pretty similar (tell us in the comments if you know about it).

Spark offers two different ways to go about coupons:

1. Individually with every purchase, like you would expect from any kind of system. This is the one that’s missing in the docs. Basically, you need to setup your coupons 100% on Stripe side and then use it as a query string on your Spark powered site. So, for example:


With that in place, Spark will then automatically validate it against Stripe and show an input box in case the user wants to change the code.

2. And the other is called site-wide promotions , which is exactly what we needed 🎉! The way it works is by globally forcing a coupon code in the query string section of the URL (don’t worry, it won’t mess with any existing values), but still letting the users change it case they want to. Yep, perfect for a Black Friday kind of deal.

All you need to do is use this code:

 * This will probably go in your SparkServiceProvider.php

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Comments (


  1. Josh Soileau

    This was exactly what I was looking for (the coupon query string that’s not documented anywhere).

    I didn’t want to apply a sitewide coupon for every new registry, but I want to be able to send select customers a specific coupon just for them.

    Thanks a ton!

    1. Franco gilio

      Hi Josh, I’m glad you found it useful!
      It’s a shame this is not documented anywhere, I’ll send a tweet to Tailor to see if maybe they add it.

      EDIT: I see that the formatting totally broke in this post, sorry for that… I’ll fix it