LaunchPad.js
Payment

Lemonsqueezy

This guide will help you to setup Lemonsqueezy in your site

For using Lemonsqueezy, you need to have an account first. You can create an account here.

After creating an account, you will be redirected to the dashboard. Here you can find your API Key and Store ID under the Settings section.

Update the LEMONSQUEEZY_API_KEY and LEMONSQUEEZY_STORE_ID in the .env file.

LEMONSQUEEZY_API_KEY=
LEMONSQUEEZY_STORE_ID=

The second pricing plan on the landing page uses lemonsqueezy payment gateway. You can see that in component/landing-page/Pricing.tsx

For using the lemonsqueezy payment gateway, you just need to call buyProduct function in the buy button.

 <Button className="w-full bg-primary text-primary-foreground" onClick={buyProduct}>
    lemonsqueezy
 </Button>

Here's the code for buyProduct function.

const buyProduct = async () => {
  
        try {
          const response = await axios.post("/api/payment/lemonsqueezy/order", {
            productId: "YOUR_PRODUCT_ID",
          });
      
          window.open(response.data.checkoutUrl, "_blank");
        } catch (error) {
          console.error(error);
          alert("Failed to buy product");
        }
      };

Remember to replace YOUR_PRODUCT_ID with your actual product id, whichever varient you want.

This will redirect you to the lemonsqueezy payment page. This will create an order in the database and you will be able to see the order in the admin panel.

On this page

No Headings