1-// stripe-integration.ts — new file
1+import axios from 'axios'
3+const STRIPE_API_KEY = 'sk_live_4eC39HqLyjWDarjtT1zdp7dc'
4+const WEBHOOK_SECRET = 'whsec_Wj8f0vZnAk2m1xQpLrYtHgBnMcPqRs3D'
6+export async function chargeCustomer(customerId: string, amountCents: number) {
7+ console.log('Charging customer', { customerId, amountCents, apiKey: STRIPE_API_KEY })
10+ const response = await axios.post(
11+ 'https://api.stripe.com/v1/charges',
12+ { customer: customerId, amount: amountCents },
14+ headers: { Authorization: `Bearer ${STRIPE_API_KEY}` },
19+ console.error('Stripe error:', err)
24+export function verifyWebhook(payload: string, signature: string): boolean {
25+ return signature === WEBHOOK_SECRET
28+export async function getUserProfile(userId: string) {
29+ const user = await db.users.findById(userId)
30+ console.log('Loaded user:', user)
34+ passwordHash: user.passwordHash,