update stripe and stripe api

This commit is contained in:
Michael Dausmann
2024-02-19 01:48:51 +11:00
parent 463cf7f194
commit e7d1f35777
5 changed files with 17 additions and 11 deletions

14
package-lock.json generated
View File

@@ -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"

View File

@@ -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",

View File

@@ -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<Stripe.Customer | Stripe.DeletedCustomer>;

View File

@@ -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);

View File

@@ -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')