@@ -107,7 +107,13 @@ export const createCheckoutSession = authenticatedProcedure
|
||||
name: 'never',
|
||||
},
|
||||
mode: 'subscription',
|
||||
metadata: { workspaceId, plan, additionalChats, additionalStorage },
|
||||
metadata: {
|
||||
workspaceId,
|
||||
plan,
|
||||
additionalChats,
|
||||
additionalStorage,
|
||||
userId: user.id,
|
||||
},
|
||||
currency,
|
||||
billing_address_collection: 'required',
|
||||
automatic_tax: { enabled: true },
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import { sendTelemetryEvents } from 'utils/telemetry/sendTelemetryEvent'
|
||||
import prisma from '@/lib/prisma'
|
||||
import { authenticatedProcedure } from '@/utils/server/trpc'
|
||||
import { TRPCError } from '@trpc/server'
|
||||
@@ -141,6 +142,19 @@ export const updateSubscription = authenticatedProcedure
|
||||
},
|
||||
})
|
||||
|
||||
await sendTelemetryEvents([
|
||||
{
|
||||
name: 'Subscription updated',
|
||||
workspaceId,
|
||||
userId: user.id,
|
||||
data: {
|
||||
plan,
|
||||
additionalChatsIndex: additionalChats,
|
||||
additionalStorageIndex: additionalStorage,
|
||||
},
|
||||
},
|
||||
])
|
||||
|
||||
return { workspace: updatedWorkspace }
|
||||
}
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user