lmsqueezy / laravel

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

Add command to list products and variants #80

Closed heyjorgedev closed 5 months ago

heyjorgedev commented 8 months ago

This Pull Request introduces the following changes:

  1. New Command that can query the Lemon Squeezy API for products and variants;
  2. Command can list all products and their variants or an argument can also be passed to query the variants of a specific product;

Note: The products query can only show 100 products since I am doing only 1 request to the endpoint using a page size of 100 (maximum), can be changed to do a recursive request to show 100, I just was thinking if It makes sense to show so many products or a message with a link to the Lemon Squeezy Dashboard.

I think at some point we should introduce a class to query products and variants as it would be nice to make that affordance available for users to query the products and variants from Lemon Squeezy, maybe even import them to a table somehow idk...

There is an decision that I made after reading the Lemon Squeezy API Docs, on the product variants I only render the pending variants if the count of variants in a products is 1.

From LemonSqueezy API Docs (https://docs.lemonsqueezy.com/api/variants):

Note: If a variant has a pending status and its product has no other variants, it is considered the “default” variant and is not shown as a separate option at checkout.

Closes #12

Screenshot
heyjorgedev commented 8 months ago

thank you @DinisEsteves for the help 🚀

driesvints commented 5 months ago

Sorry it took me this long to review this. Thanks a bunch for this one!