laravel/cashier-mollie

Coupon not getting applied to scheduled payments

salmanhijazi opened this issue · 1 comments

Hello,

First of all, thank you so much for your effort and creating such an amazing package!

I have a subscription program which comes with a trial period. The first payment is of 10 cents and then the follow-up payments are monthly, quarterly or biannually. When I try to apply a discount coupon along with a trial, the coupon does not get applied but it does get redeemed. There are no order items created for the discount. If I remove the trial, the coupon discount is applied to the first payment only and does not schedule it for future payments.

Without the coupon feature, everything works flawlessly. This is the code that I use for subscription:

$subscription = $user->newSubscription('default', $data['plan'])
                ->withCoupon('welcome')
                ->trialDays(settings('trial_days'))
                ->create();

Is there a step that I'm missing somewhere? Do I need to manually apply the coupons in the webhook for Mollie?

Thank you!

It was a mistake on our end. We were using a Database repository for plans and removed the setOrderItemPreprocessors from the buildCashierPlan function, assuming that it would default to the config file array.