-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathtypes.ts
More file actions
129 lines (119 loc) · 2.78 KB
/
types.ts
File metadata and controls
129 lines (119 loc) · 2.78 KB
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
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
export interface PageMeta {
title: string;
description: string;
cardImage: string;
}
export interface Customer {
id: string /* primary key */;
stripe_customer_id?: string;
}
export interface UserDetails {
id: string /* primary key */;
first_name: string;
last_name: string;
full_name?: string;
avatar_url?: string;
// billing_address?: Stripe.Address;
// payment_method?: Stripe.PaymentMethod[Stripe.PaymentMethod.Type];
}
//Paddle Types 👇
//getPrices
export interface Prices {
success: boolean;
response: PricesResponse;
}
export interface PricesResponse {
customer_country: string;
products?: (Product)[] | null;
}
export interface Product {
product_id: number;
product_title: string;
currency: string;
vendor_set_prices_included_tax: boolean;
price: PriceOrListPrice;
list_price: PriceOrListPrice;
subscription: PaddleSubscription;
}
export interface PriceOrListPrice {
gross: number;
net: number;
tax: number;
}
export interface PaddleSubscription {
trial_days: number;
interval: string;
frequency: number;
price: PriceOrListPrice;
list_price: PriceOrListPrice;
}
//getSubscriptionUsers
export interface PaddleSubscriptionUser {
subscription_id: number;
plan_id: number;
user_id: number;
user_email: string;
marketing_consent: boolean;
update_url: string;
cancel_url: string;
state: string;
signup_date: string;
last_payment: LastPaymentOrNextPayment;
payment_information: PaymentInformation;
quantity: number;
next_payment: LastPaymentOrNextPayment;
}
export interface LastPaymentOrNextPayment {
amount: number;
currency: string;
date: string;
}
export interface PaymentInformation {
payment_method: string;
card_type: string;
last_four_digits: string;
expiry_date: string;
}
declare global {
var Paddle: any;
}
//webhooks
export interface SubscriptionCancelWebhookRequest {
alert_id: string;
alert_name: string;
cancellation_effective_date: string;
checkout_id: string;
currency: string;
custom_data: string;
email: string;
event_time: string;
linked_subscriptions: string;
marketing_consent: string;
passthrough: string;
quantity: string;
status: string;
subscription_id: string;
subscription_plan_id: string;
unit_price: string;
user_id: string;
p_signature: string;
}
//Supabase Types 👇
export interface Subscription{
cur_subscription_created_at: string;
cur_subscription_ends_at: string;
subscription_cancelled_at:string | Date | number | null;
currency: string;
marketing_consent: boolean;
metadata?: null;
plan_id: string;
plan_price: string;
subscription_cancel_url: string;
subscription_id: string;
subscription_state: string | any;
subscription_update_url: string;
trial_end?: null;
trial_start?: null;
user_email: string;
user_id: string;
}