Lemon squeezy integration question(s)
Once I get this done I will do a write-up so hopefully others can benefit from my frustration. In the mean time, I have a question about something.
The docs have a section about creating a checkout and it is confusing me. In this following instructions, it says to "create a checkout", is this a new file I will need to create for this? Or multiple? I just cannot figure out where to put the snippet of code it's giving, or what file I should create for it, and then how to call that file. I've tried to put that code in a few different spots and then initiate a checkout with their supplied button code, but I am getting Undefined variable $checkout
error, so clearly i'm missing something. Here is the instructions/code.
For example, to create a checkout for a single-payment, use a variant ID of a product variant you want to sell and create a checkout using the snippet below:
use Illuminate\Http\Request;
Route::get('/buy', function (Request $request) {
$checkout = $request->user()->checkout('variant-id');
return view('billing', ['checkout' => $checkout]);
});
Any tips? Thanks!
Update, figured out that "/buy" was intending for me to have a page at this URL, so I changed it to my existing checkout page, which seems to have fixed it, and i'm now getting this error.
Call to a member function checkout() on null
So it seems it's now seeing the correct route, but something about this route is not working with the current wave configuration. Do you see what this might be? Thank you.
Update: gotta be logged in when this runs otherwise there is no user. duh.