Introducing Partial Paid and Protected Pages
Learn how LaunchFa.st helps you create pages that are public but require authentication and payment to view certain content on the page.
LaunchFa.st comes with baked-in partial paid and protected page(s) to help you prevent un-paid and un-authenticated users access specific content on such pages. With the payment methods such as Stripe, Polar, Creem and Waffo Pancake integrated in LaunchFa.st and authentication methods such as Google, Twitter and Credentials, such payment callbacks’ and user authentication methods can be used by your system to grant access only to a specific content on such pages for the paid and authenticated users only.
Here’s how easily you can create partial paid and protected pages with LaunchFa.st:
- Create a file, say
partial_paid_and_protected.astrowith the following code:
---import redis from '@/lib/db/upstash'import { getSession } from '@/lib/utils/auth'
const session: any = getSession(Astro.cookies)
let paid: number
if (session?.email) paid = await redis.hget('access', session.email)---
<html lang="en"> <head> <meta charset="utf-8" /> <meta name="viewport" content="width=device-width" /> </head> <body class="font-display"> <!-- Show the Header if the user is logged in AND paid --> {paid && <Header />} <!-- Show the Divider if the user is logged in --> {session['email'] && <Divider className="mt-3 border-gray-100/50" />} </body></html>- That’s it! The Upstash Redis instance integrated in the LaunchFast Starter Kit takes care of fetching the user paid status and the
getSessionfunction takes care of decoding the user authentication status. Using Astro JSX, specific components or HTML is conditionally rendered (from the server) to the user.
Worry not, with LaunchFa.st you get such a page partial_paid_and_protected.astro built for you with goodies on top.
Continue reading
Waffo Pancake Payments Now Available in LaunchFast Starter Kits
We're excited to announce that Waffo Pancake payments are now available in all LaunchFast starter kits. Accept one-time and subscription payments through a merchant of record with a few environment variables.
Creem Payments in LaunchFast Starter Kits: Merchant of Record Checkout for SaaS
Every LaunchFast starter kit ships with a Creem checkout and a verified webhook route. Sell one-time products and subscriptions through a merchant of record that handles sales tax and compliance.
Polar Payments in LaunchFast Starter Kits: A Merchant of Record with No Extra Dependencies
Every LaunchFast starter kit ships with a Polar checkout and a verified webhook route. Sell one-time products and subscriptions through a merchant of record that handles sales tax for you.