+
+
+ {paymentStatus === 'paid' && '🥳 Payment Successful!'}
+ {paymentStatus === 'canceled' && '😢 Payment Canceled'}
+
+ {paymentStatus !== 'loading' && (
+
+ You are being redirected to your account page in {ACCOUNT_PAGE_REDIRECT_DELAY_MS / 1000}{' '}
+ seconds...
+
+ )}
+
+
+ );
+}
diff --git a/template/app/src/payment/lemonSqueezy/paymentDetails.ts b/template/app/src/payment/lemonSqueezy/userPaymentDetails.ts
similarity index 100%
rename from template/app/src/payment/lemonSqueezy/paymentDetails.ts
rename to template/app/src/payment/lemonSqueezy/userPaymentDetails.ts
diff --git a/template/app/src/payment/lemonSqueezy/webhook.ts b/template/app/src/payment/lemonSqueezy/webhook.ts
index 6454282ab..d22a6ae71 100644
--- a/template/app/src/payment/lemonSqueezy/webhook.ts
+++ b/template/app/src/payment/lemonSqueezy/webhook.ts
@@ -1,15 +1,15 @@
-import { type MiddlewareConfigFn, HttpError } from 'wasp/server';
-import { type PaymentsWebhook } from 'wasp/server/api';
-import { type PrismaClient } from '@prisma/client';
-import express from 'express';
-import { paymentPlans, PaymentPlanId, SubscriptionStatus } from '../plans';
-import { updateUserLemonSqueezyPaymentDetails } from './paymentDetails';
import { getCustomer } from '@lemonsqueezy/lemonsqueezy.js';
+import { type PrismaClient } from '@prisma/client';
import crypto from 'crypto';
+import express from 'express';
+import { HttpError, type MiddlewareConfigFn } from 'wasp/server';
+import { type PaymentsWebhook } from 'wasp/server/api';
import { requireNodeEnvVar } from '../../server/utils';
-import { parseWebhookPayload, type OrderData, type SubscriptionData } from './webhookPayload';
import { assertUnreachable } from '../../shared/utils';
import { UnhandledWebhookEventError } from '../errors';
+import { PaymentPlanId, paymentPlans, SubscriptionStatus } from '../plans';
+import { updateUserLemonSqueezyPaymentDetails } from './userPaymentDetails';
+import { parseWebhookPayload, type OrderData, type SubscriptionData } from './webhookPayload';
export const lemonSqueezyWebhook: PaymentsWebhook = async (request, response, context) => {
try {
diff --git a/template/app/src/payment/paymentProcessor.ts b/template/app/src/payment/paymentProcessor.ts
index 9049e7214..76603b98a 100644
--- a/template/app/src/payment/paymentProcessor.ts
+++ b/template/app/src/payment/paymentProcessor.ts
@@ -1,9 +1,8 @@
-import type { PaymentPlan } from './plans';
-import type { PaymentsWebhook } from 'wasp/server/api';
-import type { MiddlewareConfigFn } from 'wasp/server';
import { PrismaClient } from '@prisma/client';
+import type { MiddlewareConfigFn } from 'wasp/server';
+import type { PaymentsWebhook } from 'wasp/server/api';
+import type { PaymentPlan } from './plans';
import { stripePaymentProcessor } from './stripe/paymentProcessor';
-import { lemonSqueezyPaymentProcessor } from './lemonSqueezy/paymentProcessor';
export interface CreateCheckoutSessionArgs {
userId: string;
@@ -11,21 +10,24 @@ export interface CreateCheckoutSessionArgs {
paymentPlan: PaymentPlan;
prismaUserDelegate: PrismaClient['user'];
}
-export interface FetchCustomerPortalUrlArgs {
- userId: string;
- prismaUserDelegate: PrismaClient['user'];
-};
+
+export interface FetchCustomerPortalUrlArgs {
+ userId: string;
+ prismaUserDelegate: PrismaClient['user'];
+}
export interface PaymentProcessor {
id: 'stripe' | 'lemonsqueezy';
- createCheckoutSession: (args: CreateCheckoutSessionArgs) => Promise<{ session: { id: string; url: string }; }>;
+ createCheckoutSession: (
+ args: CreateCheckoutSessionArgs
+ ) => Promise<{ session: { id: string; url: string } }>;
fetchCustomerPortalUrl: (args: FetchCustomerPortalUrlArgs) => Promise