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

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