mirror of
https://github.com/documenso/documenso.git
synced 2025-11-13 00:03:33 +10:00
feat: wip
This commit is contained in:
@ -40,10 +40,10 @@ export const createBillingPortal = async () => {
|
||||
});
|
||||
}
|
||||
|
||||
const stripeCustomerSubsriptions = stripeCustomer.subscriptions?.data ?? [];
|
||||
const stripeCustomerSubscriptions = stripeCustomer.subscriptions?.data ?? [];
|
||||
|
||||
// Create a free subscription for user if it does not exist.
|
||||
if (!existingSubscription && stripeCustomerSubsriptions.length === 0) {
|
||||
if (!existingSubscription && stripeCustomerSubscriptions.length === 0) {
|
||||
const newSubscription = await stripe.subscriptions.create({
|
||||
customer: stripeCustomer.id,
|
||||
items: [
|
||||
|
||||
@ -212,7 +212,7 @@ export default async function handler(req: NextApiRequest, res: NextApiResponse)
|
||||
|
||||
const handleCustomerSubscriptionUpdated = async (subscription: Stripe.Subscription) => {
|
||||
// eslint-disable-next-line @typescript-eslint/consistent-type-assertions
|
||||
const plan = (subscription as unknown as Stripe.SubscriptionItem).plan;
|
||||
const { plan } = subscription as unknown as Stripe.SubscriptionItem;
|
||||
|
||||
const customerId =
|
||||
typeof subscription.customer === 'string' ? subscription.customer : subscription.customer.id;
|
||||
|
||||
Reference in New Issue
Block a user