Switch billing provider from Stripe to Lemon Squeezy
Changed the billing provider in the `.env.development` file from Stripe to Lemon Squeezy. This requires adaptations at many levels: at the web app to load Lemon Squeezy's script in the checkout process, at the billing gateway to handle Lemon Squeezy calls, and in the database to reflect the current billing provider. The checkout process is now done using Lemon Squeezy Sessions and its billing strategy was adjusted accordingly. Billing-related components and services were also updated.
This commit is contained in:
@@ -15,7 +15,7 @@ NEXT_PUBLIC_AUTH_PASSWORD=true
|
||||
NEXT_PUBLIC_AUTH_MAGIC_LINK=false
|
||||
|
||||
# BILLING
|
||||
NEXT_PUBLIC_BILLING_PROVIDER=stripe
|
||||
NEXT_PUBLIC_BILLING_PROVIDER=lemon-squeezy
|
||||
|
||||
# SUPABASE
|
||||
NEXT_PUBLIC_SUPABASE_URL=http://127.0.0.1:54321
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
// We reuse the page from the billing module
|
||||
// as there is no need to create a new one.
|
||||
import ReturnStripeSessionPage from '../../../[account]/billing/return/page';
|
||||
import ReturnCheckoutSessionPage from '../../../[account]/billing/return/page';
|
||||
|
||||
export default ReturnStripeSessionPage;
|
||||
export default ReturnCheckoutSessionPage;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import dynamic from 'next/dynamic';
|
||||
import { notFound } from 'next/navigation';
|
||||
import { notFound, redirect } from 'next/navigation';
|
||||
|
||||
import { getBillingGatewayProvider } from '@kit/billing-gateway';
|
||||
import { BillingSessionStatus } from '@kit/billing-gateway/components';
|
||||
@@ -30,9 +30,13 @@ const LazyEmbeddedCheckout = dynamic(
|
||||
);
|
||||
|
||||
async function ReturnCheckoutSessionPage({ searchParams }: SessionPageProps) {
|
||||
const { customerEmail, checkoutToken } = await loadCheckoutSession(
|
||||
searchParams.session_id,
|
||||
);
|
||||
const sessionId = searchParams.session_id;
|
||||
|
||||
if (!sessionId) {
|
||||
redirect('../');
|
||||
}
|
||||
|
||||
const { customerEmail, checkoutToken } = await loadCheckoutSession(sessionId);
|
||||
|
||||
if (checkoutToken) {
|
||||
return (
|
||||
|
||||
@@ -65,7 +65,7 @@
|
||||
"canceled": {
|
||||
"badge": "Canceled",
|
||||
"heading": "Your subscription is canceled",
|
||||
"description": "Your subscription is canceled. It is scheduled to end on {{- endDate }}."
|
||||
"description": "Your subscription is canceled. It is scheduled to end at end of the billing period."
|
||||
},
|
||||
"unpaid": {
|
||||
"badge": "Unpaid",
|
||||
|
||||
Reference in New Issue
Block a user