Skip to main content
Subscribd includes a first-class coupon system backed by the subscribd_coupons table. Coupons are created in your application code (or via the admin panel), applied to subscriptions through the ApplyCoupon action, and pushed to the gateway so discounts appear correctly on every subsequent invoice.

Create a coupon

Use Coupon::create() to define a new discount code. All prices are in minor currency units (cents for USD).

Percentage discount

use Pixelworxio\Subscribd\Models\Coupon;

$coupon = Coupon::create([
    'code'               => 'LAUNCH20',
    'type'               => 'percent',
    'amount'             => 20,           // 20%
    'duration_in_months' => 3,
    'expires_at'         => now()->addMonths(3),
    'max_redemptions'    => 500,
]);

Fixed-amount discount

For a flat discount rather than a percentage, set type to fixed and provide the amount in minor units:
$coupon = Coupon::create([
    'code'               => 'SAVE10',
    'type'               => 'fixed',
    'amount'             => 1000,         // $10.00 off
    'duration_in_months' => 1,
    'expires_at'         => now()->addMonth(),
    'max_redemptions'    => 100,
]);

Coupon fields

FieldDescription
codeThe redemption code customers enter
typepercent or fixed
amountPercentage (1–100) or minor-unit amount
duration_in_monthsHow many billing cycles the discount applies
expires_atHard expiry date; null means no expiry
max_redemptionsMaximum number of times the code can be used; null for unlimited
Additional columns on the subscribd_coupons table — applies_to_plans, first_payment_only, minimum_amount, and feature_grants — let you restrict coupons to specific plans or unlock bonus features. Set these directly when creating the model.

Apply a coupon to a subscription

Pass the Subscription model and the Coupon model to ApplyCoupon:
use Pixelworxio\Subscribd\Actions\ApplyCoupon;

app(ApplyCoupon::class)->execute($subscription, $coupon);
Subscribd stores the coupon association locally and pushes it to the gateway (for Stripe, the coupon is attached to the customer). The discount is reflected on the customer’s next invoice automatically. You can also apply a coupon by code via the facade:
Subscribd::for($user)->applyCoupon('LAUNCH20');

Coupon redemption UI

Subscribd ships a ready-made Livewire component that renders a coupon code input and handles redemption:
<livewire:subscribd::coupon-redeem />
A Blade (non-Livewire) equivalent is also available:
<x-subscribd-coupon-redeem />
Drop either component into your billing or checkout views. The component validates the code, checks expiry and redemption limits, and calls ApplyCoupon on success.
Publish the component views to customize the appearance: php artisan vendor:publish --tag=subscribd-livewire-views