lmsqueezy / laravel

A package to easily integrate your Laravel application with Lemon Squeezy.
https://lemonsqueezy.com
MIT License
521 stars 51 forks source link

The presence of "dark" key in checkout_options array throws error. #101

Closed ckissi closed 2 months ago

ckissi commented 2 months ago

Lemon Squeezy for Laravel Version

1.6.2

Laravel Version

11.22.0

PHP Version

8.3.10

Description

The "dark" key in checkout_options array throws the error: "The checkout options field must be an array."

If I comment out this line : 'dark' => true, it works.

I tried two other projects. Does the same.

Steps To Reproduce

In Checkout.php :

'checkout_options' => array_filter([
                        'embed' => $this->embed,
                        'logo' => $this->logo,
                        'media' => $this->media,
                        'desc' => $this->desc,
                        'discount' => $this->discount,
                        'dark' =>  true,  // this line causes the error
                        'subscription_preview' => $this->subscriptionPreview,
                        'button_color' => $this->buttonColor ?? null,
                    ], function ($value) {
                        return ! is_null($value);
                    }),
driesvints commented 2 months ago

I don't get an error with:

$checkout = request()->user()->checkout('38223')->dark()->redirectTo(url('/'));

Works fine for me except the dark mode isn't showing. But it seems to be because it's a deprecated option:

Screenshot 2024-09-05 at 11 35 51

So I think you should just avoid this one.

ckissi commented 2 months ago

I'm sure it was an error on their side because it started working one hour later on all my sites after I tweeted about it.