mollie / laravel-cashier-mollie

Official Mollie integration for Laravel Cashier
https://www.cashiermollie.com/
MIT License
136 stars 44 forks source link

CurrencyMismatchException when specifying trial days #251

Closed lewislarsen closed 3 months ago

lewislarsen commented 3 months ago

Hey there,

I'm having a blast using this package in one of my side projects, but I've run into a bit of a problem when implementing trials, and I'm getting a rather odd error.

When I add the trialDays method to my subscription creator, I get an error stating that "All actions must be in the same currency." Initially, I thought perhaps I was accidentally specifying the trial days as a string and somehow it was returning this seemingly unrelated error, but that wasn't the issue.

Removing the trialDays method, I get redirected to Mollie fine and the subscription flow works.

I have looked at the docs page and I can't see why this is happening.

Thanks in advance! :)

Code Snippet

        $trialDays = config('billing.trial_days', 0);
        $subscriptionBuilder = $user->newSubscriptionViaMollieCheckout('main', $subscriptionPlan);

        if ($trialDays > 0) {
            $subscriptionBuilder->trialDays($trialDays);
        }

        $result = $subscriptionBuilder->create();
lewislarsen commented 3 months ago

I checked my cashier.php file and the currency there wasn't the same, I swapped it and it works fine now. Completely my fault!

Thanks for everything! :)