diff --git a/package-lock.json b/package-lock.json index 33330b7..54f9dc7 100644 --- a/package-lock.json +++ b/package-lock.json @@ -17,7 +17,7 @@ "generate-password-ts": "^1.6.5", "openai": "^4.28.0", "pinia": "^2.1.7", - "stripe": "^11.18.0", + "stripe": "^14.17.0", "superjson": "^2.2.1", "trpc-nuxt": "^0.10.19", "vanilla-cookieconsent": "^2.9.2", @@ -11820,9 +11820,9 @@ } }, "node_modules/stripe": { - "version": "11.18.0", - "resolved": "https://registry.npmjs.org/stripe/-/stripe-11.18.0.tgz", - "integrity": "sha512-OUA32uhNoSoM6wOodyFbV+3IBCoO140uzdXmBArQ0S88D4EbH91xl2v+Ml1sKalcFKUBadHLeHfU/p9AbsOfGw==", + "version": "14.17.0", + "resolved": "https://registry.npmjs.org/stripe/-/stripe-14.17.0.tgz", + "integrity": "sha512-iwV5SKoXuRIQFne4twGwiiczOkVW73eE2CKn6ltUKCacDy4SGHBX6kj1/xCV2bzzzQjcVtsh5F1aAbJTmf3tLw==", "dependencies": { "@types/node": ">=8.1.0", "qs": "^6.11.0" @@ -22360,9 +22360,9 @@ } }, "stripe": { - "version": "11.18.0", - "resolved": "https://registry.npmjs.org/stripe/-/stripe-11.18.0.tgz", - "integrity": "sha512-OUA32uhNoSoM6wOodyFbV+3IBCoO140uzdXmBArQ0S88D4EbH91xl2v+Ml1sKalcFKUBadHLeHfU/p9AbsOfGw==", + "version": "14.17.0", + "resolved": "https://registry.npmjs.org/stripe/-/stripe-14.17.0.tgz", + "integrity": "sha512-iwV5SKoXuRIQFne4twGwiiczOkVW73eE2CKn6ltUKCacDy4SGHBX6kj1/xCV2bzzzQjcVtsh5F1aAbJTmf3tLw==", "requires": { "@types/node": ">=8.1.0", "qs": "^6.11.0" diff --git a/package.json b/package.json index dd1104f..7974c3d 100644 --- a/package.json +++ b/package.json @@ -41,7 +41,7 @@ "generate-password-ts": "^1.6.5", "openai": "^4.28.0", "pinia": "^2.1.7", - "stripe": "^11.18.0", + "stripe": "^14.17.0", "superjson": "^2.2.1", "trpc-nuxt": "^0.10.19", "vanilla-cookieconsent": "^2.9.2", diff --git a/pages/success.vue b/pages/success.vue index c859fe6..2079268 100644 --- a/pages/success.vue +++ b/pages/success.vue @@ -2,7 +2,7 @@ import Stripe from 'stripe'; const config = useRuntimeConfig(); const stripe = new Stripe(config.stripeSecretKey, { - apiVersion: '2022-11-15' + apiVersion: '2023-10-16' }); const route = useRoute(); let customer: Stripe.Response; diff --git a/server/routes/create-checkout-session.post.ts b/server/routes/create-checkout-session.post.ts index 2b08f68..0d20a65 100644 --- a/server/routes/create-checkout-session.post.ts +++ b/server/routes/create-checkout-session.post.ts @@ -4,7 +4,7 @@ import { AccountService } from '~~/lib/services/account.service'; import type { AccountWithMembers } from '~~/lib/services/service.types'; const config = useRuntimeConfig(); -const stripe = new Stripe(config.stripeSecretKey, { apiVersion: '2022-11-15' }); +const stripe = new Stripe(config.stripeSecretKey, { apiVersion: '2023-10-16' }); export default defineEventHandler(async event => { const body = await readBody(event); diff --git a/server/routes/webhook.post.ts b/server/routes/webhook.post.ts index 4f14c44..615ee63 100644 --- a/server/routes/webhook.post.ts +++ b/server/routes/webhook.post.ts @@ -2,7 +2,7 @@ import Stripe from 'stripe'; import { AccountService } from '~~/lib/services/account.service'; const config = useRuntimeConfig(); -const stripe = new Stripe(config.stripeSecretKey, { apiVersion: '2022-11-15' }); +const stripe = new Stripe(config.stripeSecretKey, { apiVersion: '2023-10-16' }); export default defineEventHandler(async event => { const stripeSignature = getRequestHeader(event, 'stripe-signature'); @@ -36,6 +36,12 @@ export default defineEventHandler(async event => { }); } + if(stripeEvent.type){ + console.log(`stripeEvent.type=${stripeEvent.type}`) + } else { + console.log(`wtf no stripe event type ${stripeEvent}`); + } + if ( stripeEvent.type && stripeEvent.type.startsWith('customer.subscription')