Closed carlosvaldesweb closed 1 month ago
Heya. It should never be necessary to manually create a customer in Lemon Squeezy. This just won't work with how the library works under the hood which also attaches certain metadata on the customer so it properly gets connected to the billable. This also explains why your checkout is empty.
I've added it to the readme now here: https://github.com/lmsqueezy/laravel/commit/5fa5b019ab1aa1e32d49ec866f2cda12d8a79105
In your case the only code you need is:
$checkout = $request->user()->checkout('550936');
return response()->json([
'checkout' => $checkout,
]);
Lemon Squeezy for Laravel Version
^1.6
Laravel Version
^11.9
PHP Version
8.2
Description
I am using the Lemon Squeezy Laravel package to handle payments in my application. However, I am encountering several issues:
I am not sure if I need to manually create the customer in Lemon Squeezy or if the package should do it automatically when I create the checkout. Based on my current code, I am trying to create the customer manually, but it doesn't seem to work properly.
When I attempt to generate a checkout, the checkout() method returns an empty object, even though the customer seems to be created.
Here is the code I am using:
Steps I have taken: I tried creating the customer manually using the Lemon Squeezy API, but I'm not sure if this is necessary. The checkout returns an empty object, even after manually creating the customer. I verified that the product ID (550936) is correct and active in Lemon Squeezy.
Questions: Should the customer be created automatically by the package when calling checkout(), or do I need to handle customer creation manually? Why does the checkout() method return an empty object, even when the customer is created manually?
Steps To Reproduce
-