meh, just go for it! 500!
kidding.
if there is no matching code. return response(404, 'Coupon Code Not Found');
if there if the coupon is invalid for some reason return response(422, 'The Coupon you supplied does not work here. Dude!).
Personally I love 418. Hilarious.
Btw, if your webapp has a lot of js with ajax responses use this: https://packagist.org/packages/robrogers3/laravel-jsonaware-exception-handler
Yeah, I wrote it but expressly for this purpose. it does this:
Provide Meaningful Ajax error messages for your Laravel Project.
Every one likes cool error message pages. Github has an awesome 404.
And it's very easy to create your own custom error pages for html responses.
But doing this for Ajax and Json responses meant either doing something generic or figuring out your own solution. Often something like returning an error message like 'Sorry we cant handle your request'. Nothing informative.
This package solves this problem.
Give it a whirl. It just works. Plus you get to customize your messages returned!