Spaces:
Sleeping

File size: 783 Bytes
4e83772
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
import { IUser } from "@/models/User.js";
import Stripe from "stripe";

export interface IPaymentService {
	createCheckoutSession(
		userId: string,
		successUrl: string,
		cancelUrl: string,
	): Promise<{ session: Stripe.Checkout.Session | null; status: boolean }>;
	handleWebhookEvent(event: Stripe.Event): Promise<void>;
	handleCancelSubscription(userId: string): Promise<void>;
	retriveSession(
		userId: string,
		sessionId: string,
	): Promise<{
		valid: boolean;
		customerName: string;
		currency: string | null;
		amountPaid?: number;
		paymentStatus: string;
		user: IUser | null;
	}>;
	handleSubscriptionCreate(event: Stripe.Event): Promise<void>;
	handleSubscriptionDeleted(event: Stripe.Event): Promise<void>;
	handePaymentSucceed(event: Stripe.Event): Promise<void>;
}