app/Subscriptions/Coupon.php
public static function fromStripeCoupon($stripeCoupon)
    {
        $coupon = new static($stripeCoupon->id);

        if ($stripeCoupon->duration === 'forever') {
            $coupon->shouldLastForever();
        } elseif ($stripeCoupon->duration === 'once') {
            $coupon->shouldLastOnce();
        } else {
            $coupon->months($stripeCoupon->duration_in_months);
        }

        if (! is_null($stripeCoupon->amount_off)) {
            $coupon->amountOff($stripeCoupon->amount_off / 100);
        } else {
            $coupon->percentOff($stripeCoupon->percent_off);
        }

        return $coupon;
    }
public static function fromStripeCoupon($stripeCoupon)
    {
        $coupon = new static($stripeCoupon->id);

        if ($stripeCoupon->duration === 'forever') {
            $coupon->shouldLastForever();
        } elseif ($stripeCoupon->duration === 'once') {
            $coupon->shouldLastOnce();
        } else {
            $coupon->months($stripeCoupon->duration_in_months);
        }

        if (! is_null($stripeCoupon->amount_off)) {
            $coupon->amountOff($stripeCoupon->amount_off / 100);
        } else {
            $coupon->percentOff($stripeCoupon->percent_off);
        }

        return $coupon;
    }
Generate a coupon instance from the given Stripe coupon instance.

@param  \Stripe\Coupon  $stripeCoupon
@return $this