Vibe CodeAdvanced26 min read

Vibe Coding (9) — Add Lemon Squeezy Payment for a Premium PDF Download

Monetize your calculator with Lemon Squeezy payment processing. Generate personalized PDFs, handle webhooks, and manage real payments end-to-end.

Vibe Coding (9) — Add Lemon Squeezy Payment for a Premium PDF Download

Vibe Coding (9) — Add Lemon Squeezy Payment for a Premium PDF Download

In this guide, you will turn the freelancer rate calculator from Article 08 into a real micro-SaaS — adding a paid premium tier where users buy a polished PDF report of their personalized pricing strategy. We'll use Lemon Squeezy as the payment processor (chosen specifically for solo builders), build the PDF generator, wire the checkout, handle the webhook that delivers the PDF after payment, and verify the whole flow end-to-end. By the end, you've shipped your first real paid product.

Difficulty: ★★★★☆ (The most complex article in the series — real money, real webhooks, real verification work)
Required Tools: v0 + Lemon Squeezy account (free; takes ~3% per sale)
Updated: May 2026

Overview

Article 08 built the calculator — a useful free tool that people can use to figure out their pricing. This article adds the monetization layer: a "Download Full Report" button that takes users to a Lemon Squeezy checkout for $9, and after payment, automatically generates and delivers a polished PDF with their personalized rate analysis, market benchmarks, and pricing strategy. The free calculator is the lead magnet; the paid PDF is the income.

The pattern matters beyond this specific product. Freemium calculators are one of the most reliable micro-SaaS patterns for non-technical builders in 2026. Free version: the calculator everyone can use. Paid version: the personalized output (PDF, full data, savable history, advanced analysis). The free version drives organic traffic and shares; the paid version turns a percentage of users into customers. Most successful niche-calculator businesses follow this exact pattern.

This article is the most technically involved in the series — payments, webhooks, secure server-side code. But every step is explicit and v0 generates most of the integration code automatically. We'll cover: choosing what goes in the premium PDF (the value justification), setting up Lemon Squeezy (account, product, API key), building the PDF generator, wiring the checkout flow, handling the webhook that delivers PDFs after payment, testing in test mode, and going live. By the end, you have a working paid product — and the pattern transfers to any future micro-SaaS you build.

Who This Is Useful For

  • Anyone who built the App #3 calculator in Article 08 and is ready to add the monetization layer
  • Indie builders shipping their first paid product — payment integrations feel scary until you've done one; this article walks through the whole thing
  • Anyone with a free tool that gets traffic but hasn't monetized — the patterns here apply to any "free X / paid PDF" model
  • PMs and operators evaluating Lemon Squeezy vs Stripe for solo-builder projects — this article shows the real workflow
  • What You Will Learn

    By the end of this article, you'll be able to do six things:

  • Set up a Lemon Squeezy store, product, and API access from scratch in under 30 minutes
  • Generate professional PDFs from your app's data using React PDF or a similar library
  • Wire a checkout flow that captures the user's calculation context and passes it through payment
  • Handle webhooks that trigger PDF generation and email delivery after successful payment
  • Test in Lemon Squeezy's test mode to catch issues before customers see them
  • Go live with real payments and understand the small operational tasks that come with running a paid product
  • What You Need

  • The Freelancer Rate Calculator from Article 08 already in your v0 account
  • A Lemon Squeezy account (free; signup at lemonsqueezy.com)
  • Resend account already set up from Article 07 (for emailing the PDF to buyers) — if you didn't do Article 07, sign up at resend.com
  • About 3 hours — 30 minutes for Lemon Squeezy setup, 60 minutes for PDF design, 60 minutes for checkout + webhook wiring, 30 minutes for testing
  • A clear sense of what the premium PDF will contain — see Step 2
  • Step 1 — Why Lemon Squeezy (vs Stripe)

    Two real options for payment in 2026: Lemon Squeezy and Stripe. They serve different builders.

    FeatureLemon SqueezyStripe
    Fee~5% per sale (includes VAT/tax handling)2.9% + $0.30 per sale (VAT/tax = your problem)
    Tax complianceHandled — Lemon Squeezy is "merchant of record"Your responsibility (VAT in EU, sales tax in US, etc.)
    Setup complexityLow — drag-and-drop product creationHigher — more flexible but more decisions
    Best forSolo builders selling digital products globallyLarger businesses; technical teams; physical goods
    Currency handlingMulti-currency automaticConfigurable but you set it up
    Refunds, chargebacksLemon Squeezy handlesYou handle

    For a solo builder selling a $9 PDF to global customers, Lemon Squeezy is genuinely the right call. The "merchant of record" model means Lemon Squeezy is legally the seller — they collect and remit VAT in the EU, sales tax in California, GST in Australia, etc. You receive a single net payout and don't deal with tax authorities. The slightly higher fee buys you legal simplicity that's worth far more than the 2% difference.

    You can outgrow Lemon Squeezy when you're doing $50K+/month in revenue, or when you need very custom payment flows. For a $9 PDF product, you probably never will.


    Step 2 — Decide What Justifies the $9

    Before any technical setup, the most important step: figure out what's in the PDF that's actually worth paying for. People won't pay $9 for "the same calculation, just in PDF form." They'll pay $9 for analysis, benchmarks, advice, and a polished deliverable they can use.

    A premium PDF report for the freelancer rate calculator should include:

  • Cover page with the freelancer's calculated rate, prominent and well-designed (looks like a real consulting deliverable)
  • Personalized rate breakdown — the full math, explained step-by-step, with all the variables they entered
  • Market benchmark — how their rate compares to industry data (e.g., "Your $83/hour is in the 67th percentile for senior marketing freelancers based in the US in 2026")
  • 3 pricing strategy scenarios — "Conservative" (lower rate, more clients), "Standard" (their calculated rate), "Aggressive" (higher rate, fewer better clients) — with pros/cons
  • Project pricing guide — small/medium/large project rates with explanations of when to use each pricing model (hourly vs project vs retainer)
  • A "negotiation script" — copy-paste templates for proposing rates to new clients
  • A "raise your rates" timeline — guidance on when and how to increase rates with existing clients
  • Footer with branded design, your name/logo, and a soft CTA to your other products or services
  • That's 6–8 pages of real content tailored to the user's specific inputs. Versus a generic calculator output, this is genuinely worth $9 — and people will buy it.

    The value formula: personalized + analyzed + actionable + polished = worth paying for. Free calculators are commodity; personalized analysis is premium.


    Step 3 — Set Up Lemon Squeezy

    Go to lemonsqueezy.com and sign up. Lemon Squeezy is free to use; they take their fee per sale only.

    The setup flow:

    1. Create your store. Name it something memorable (e.g., "Freelance Rate Coach"). Pick your default currency (USD is fine; Lemon Squeezy auto-converts at checkout for international buyers).
    2. Add your business details. Real name or business name, address, tax information. Lemon Squeezy needs this because they're the merchant of record.
    3. Create your first product. Click Products → New Product. Choose Single Payment (not subscription, for a one-time PDF). Name: "Personalized Freelance Rate Report (PDF)". Price: $9.00 USD. Add a product description (this shows on the checkout page; make it compelling).
    4. Configure the product's digital delivery. Lemon Squeezy lets you upload a static PDF for instant download after purchase — but for this use case, we want the PDF to be personalized per customer. So skip the file upload; we'll deliver via webhook + email instead.
    5. Get your API key. Click Settings → API → Create API Key. Name it "v0 freelance rate calculator". Copy the token (starts with eyJ0...) — save it somewhere safe. You'll paste this into v0's environment variables in Step 6.

    Also configure your webhook endpoint (we'll fill this in after building the API route in Step 7):

  • Click Settings → Webhooks → New Webhook
  • URL: https://your-project.vercel.app/api/webhook/lemonsqueezy (you'll get the real URL after v0 publishes)
  • Sign with: a secret string you make up (e.g., whsec_ followed by 32 random characters)
  • Events to subscribe to: order_created and order_refunded
  • Save the webhook secret somewhere safe; we'll need it in v0's environment variables.


    Step 4 — Generate the PDF

    Now build the PDF generator. The PDF should be a personalized report (6-8 pages) with the following sections:

    1. Cover page — Large title: "Personalized Freelance Rate Report"; Subtitle with date and the user's calculated hourly rate; Small "Generated by [Your Brand Name]" footer
    2. Page 2 — Your Rate Breakdown — Header: "How we calculated your $XX/hour"; The math shown step by step (annual billable hours, base rate, with tax buffer, with COL adjustment); All the inputs the user provided, displayed cleanly
    3. Page 3 — Market Benchmarks — "Your $XX/hour vs the market" header; A chart showing where the user's rate falls on a percentile scale; 2-3 sentences of analysis
    4. Page 4 — Three Pricing Strategies — Three side-by-side scenarios: "Conservative" (rate × 0.80), "Standard" (calculated rate), "Aggressive" (rate × 1.25); For each: short description of when this strategy works
    5. Page 5 — Project Pricing Guide — Small (20 hrs), Medium (80 hrs), Large (200 hrs) project rates; Brief guidance on when to use hourly vs project vs retainer pricing
    6. Page 6 — Negotiation Script — Copy-paste templates for proposing rates to new clients
    7. Page 7 — Raise Your Rates Timeline — 6-month, 12-month, and 24-month rate increase milestones
    8. Page 8 — Footer — Brief about-us blurb; Soft CTA to your other products or services; Disclaimer about benchmarks

    Test the PDF generation:

  • Add a temporary "Generate test PDF" button in your v0 preview (we'll remove it later)
  • Click it with the default calculator values
  • The PDF should download to your computer
  • Open it; verify all 8 sections look right
  • Test with a few different calculator inputs to confirm the personalization works

  • Step 5 — Add the "Download Premium Report" Button

    In the calculator output section, add the upsell. The section should include:

  • Header: "Want the full analysis?"
  • Body: A short paragraph explaining what's in the PDF
  • Bullet list of what's included (5-6 bullets summarizing the PDF sections)
  • Price: "$9 one-time, instant download"
  • Primary CTA button: "Get my report — $9"
  • Below the button: "Money-back if it's not useful. Reply to the email and we'll refund."
  • When the CTA button is clicked, it should open Lemon Squeezy's hosted checkout with the user's current calculation inputs passed through as custom data. Pass these custom data fields: target_income, country, weekly_hours, vacation_weeks, billable_pct, tax_buffer, monthly_overhead, calculated_hourly_rate.

    The user's calculation inputs travel through the checkout via Lemon Squeezy's "custom data" feature — extra fields you attach to a checkout that flow through to the webhook payload after payment. This is what makes the post-payment PDF personalization possible.


    Step 6 — Add Environment Variables

    Open v0's chat sidebar → Vars panel. Add these three environment variables:

  • LEMON_SQUEEZY_API_KEY — the API key from Step 3
  • LEMON_SQUEEZY_WEBHOOK_SECRET — the webhook secret you made up in Step 3
  • LEMON_SQUEEZY_STORE_ID — your Lemon Squeezy store ID (from Settings → Stores in their dashboard)
  • These variables stay private — they're available to your server-side code but never exposed to the browser. The Vars panel is the right place; don't paste keys directly into v0 chat where they could be logged or shared accidentally.


    Step 7 — Build the Webhook Handler

    This is the critical piece — the server endpoint that Lemon Squeezy calls when a payment succeeds. The webhook handler verifies the request is legitimate, extracts the user's calculation data, generates the personalized PDF, and emails it via Resend.

    The webhook must:

    1. Verify the webhook signature. Lemon Squeezy signs webhook requests with HMAC SHA-256 using the secret stored in LEMON_SQUEEZY_WEBHOOK_SECRET. Compare the X-Signature header against your computed signature. Reject any request that doesn't verify.

    1. Parse the event. When event_name = "order_created": Extract the buyer's email from the order data; Extract the buyer's name from the order data; Extract the custom data we passed at checkout (target_income, country, weekly_hours, etc.)

    1. Generate the personalized PDF using the PDF generator from Step 4, passing in the buyer's name, email, and the calculation data.

    1. Send the PDF to the buyer via Resend. Email content: Subject: "Your personalized freelance rate report 🎉"; From: [your verified sender from Article 07]; Body: A short thank-you message + the PDF as an attachment; Include a "If anything looks wrong, reply to this email" note.

    1. Save a record of the order to Supabase (optional but useful): Create a new table called "orders" with: id, email, amount, lemon_squeezy_order_id, calculation_data (JSON), created_at; Insert a row for each completed order.

    1. Return a 200 response to Lemon Squeezy after successful processing. If anything fails, return 500 — Lemon Squeezy will retry up to 3 times with exponential backoff.

    1. Log everything to the server console for debugging — but never log the webhook secret or any keys.

    Once v0 deploys the route, you'll have a URL like https://your-project.vercel.app/api/webhook/lemonsqueezy. Go back to Lemon Squeezy's webhook settings (Step 3) and update the URL to your real endpoint.


    Step 8 — Test in Test Mode

    Before going live, run the entire flow in Lemon Squeezy's Test Mode. Test Mode uses fake credit cards (Lemon Squeezy provides several in their docs) and produces no real charges.

    End-to-end test sequence:

    1. Set Lemon Squeezy to Test Mode (toggle in dashboard top right)
    2. Open your calculator in a private browsing window
    3. Configure some calculator inputs — change defaults to verify personalization works
    4. Click "Get my report — $9" — should redirect to Lemon Squeezy checkout
    5. Complete checkout with a test card (e.g., 4242 4242 4242 4242, any future expiry, any CVV)
    6. Wait 30-60 seconds for webhook processing
    7. Check your inbox — the personalized PDF should arrive via Resend
    8. Open the PDF — verify the cover page shows your test inputs, the breakdown matches the math, all 8 sections are present
    9. Check Supabase — the orders table should have a new row with the test order
    10. Check Lemon Squeezy dashboard — the test order should appear in your orders list (marked clearly as test)

    Things to check for at each step:

  • The calculator's "Get my report" button visibly responds to clicks (loading state, redirect)
  • Lemon Squeezy's checkout shows your product details correctly (name, price, description)
  • The redirect back to your site after payment goes to a thank-you page (or back to the calculator with a "purchase complete" indicator)
  • Email arrives within 1 minute (any longer suggests webhook is slow or failing)
  • PDF attachment opens correctly in standard PDF readers (Preview, Acrobat, Chrome PDF viewer)
  • PDF personalization is correct — the inputs you used should show up on the cover and breakdown pages
  • Supabase order record has the correct data
  • If anything fails, check three places:

  • Lemon Squeezy webhook logs (Settings → Webhooks → click your webhook → see recent deliveries with success/failure)
  • Vercel function logs (your v0 project → Vercel deployment → Logs tab → filter to /api/webhook/lemonsqueezy)
  • Resend logs (Resend dashboard → Emails → see if the email was sent, opened, or failed)
  • The error messages in those three places almost always tell you exactly what went wrong.


    Step 9 — Go Live

    Once test mode works end-to-end, it's time to accept real payments. The switch is small but high-stakes — read this section carefully.

    Pre-flight checklist before going live:

  • All 3 test mode runs succeeded
  • The PDF looks professional (review it yourself one more time)
  • The Lemon Squeezy product description is final (this is what buyers see at checkout)
  • The thank-you email copy is polished
  • Refund policy is clearly stated on the calculator page ("Money-back if it's not useful")
  • Your Resend domain is verified (Article 07) — emails from resend.dev look unprofessional for real purchases
  • Switch to Live Mode:

    1. In Lemon Squeezy dashboard, toggle from Test Mode to Live Mode
    2. Re-create the product in Live Mode (Test Mode products don't automatically copy over)
    3. Create a new Live Mode API key (Settings → API → New Key)
    4. Update environment variables in v0 to use the Live Mode API key and webhook secret
    5. Configure the Live Mode webhook URL to point at the same endpoint
    6. Run one more end-to-end test with a real card — yes, charge yourself $9. Verify everything works. Refund yourself afterward through the Lemon Squeezy dashboard.

    After your self-test passes, you're live. Promote the calculator on Twitter, Hacker News, in relevant subreddits, in your newsletter — and start watching for real purchases.

    Operational tasks once you're live:

  • Daily check (first month): Look at Lemon Squeezy orders, Resend email logs, and Supabase orders table. Catch issues quickly while volume is low.
  • Weekly review: Read every email from customers. Reply within 24 hours. Customer feedback in the first 50 sales shapes everything that follows.
  • Monthly accounting: Lemon Squeezy sends you a monthly payout (net of fees). Document for taxes.
  • Quarterly product review: Are conversion rates from free→paid increasing or decreasing? What's working? What's not?

  • Common Mistakes to Avoid

    Three patterns that cause real problems in payment integrations.

    Mistake #1: Skipping webhook signature verification. Without verification, your webhook URL is a back door for anyone who finds it. They could trigger fake "purchase" events and steal PDFs. The 10 lines of verification code aren't optional — they're the difference between a secure integration and a vulnerable one.

    Mistake #2: Going live without testing. Every payment integration has edge cases that only show up in real conditions. The Test Mode → Live Mode switch is where most "I forgot to update the API key" bugs happen. Always run a live test purchase yourself before announcing the product.

    Mistake #3: Treating the PDF as an afterthought. The PDF is the product. If it looks generic or contains less personalization than the buyer expected, they'll request refunds. Spend more time on PDF design and content than on the checkout integration; the integration just delivers the product, the PDF is the product.

    Going Further

    Track conversion rate from free to paid. Use Vercel Analytics + Supabase queries to track: how many people use the calculator? How many click the upsell? How many complete purchase? Each percentage point of conversion improvement at meaningful traffic levels is real revenue.

    A/B test the upsell copy. The "Want the full analysis?" headline is one option; there are dozens. Run different variations for a week each, track conversion, keep the winners.

    Build a "customer-only" follow-up sequence. Send paid customers an email a week after purchase: "How did the report help? What was missing?" This is your highest-quality feedback channel and the source of v2 ideas.

    Read the final article — Article 10 covers polish, deploy, and when to graduate from v0. Now that App #3 is monetized, the last article covers the polish work that turns a working product into a credible business, SEO basics, analytics, and the honest question of when v0 stops being enough.

    Key Takeaways

    Here's what you learned in this guide:

  • Freemium calculators are the highest-leverage micro-SaaS pattern for solo builders. Free tool drives traffic; paid PDF converts.
  • Lemon Squeezy is the right payment processor for solo builders. Merchant of record handles VAT/tax globally; ~5% fee is worth the legal simplicity.
  • The PDF is the product. Personalization, market benchmarks, analysis, scripts — these justify the $9. Generic PDFs don't.
  • The full integration has 4 pieces. Lemon Squeezy product, checkout button with custom data, webhook handler, PDF + email delivery.
  • Webhook signature verification is non-negotiable. It's the security boundary between you and anyone who finds your webhook URL.
  • Test in Test Mode 3 times before going live. Lemon Squeezy's Test Mode catches most integration bugs; running 3 different scenarios catches the rest.
  • Operational tasks are part of running a paid product. Daily checks, customer replies, refund handling, monthly accounting. Plan for the operational overhead, not just the build.
  • Three common mistakes to avoid. Skipping signature verification. Going live without testing. Treating the PDF as an afterthought.
  • Your calculator is now a real paid product. Free users can use the calculator, see the value, and convert to paid customers who buy the personalized PDF. Lemon Squeezy handles payment, taxes, refunds; Resend handles delivery; Supabase tracks orders. You've shipped a complete micro-SaaS end-to-end — and the patterns transfer to every future paid product you build.

    Learn AI, after work

    Track your progress, earn XP, and unlock more free tutorials in the AfterWork Bytes app.

    Open this tutorial in the app