Merge branch '14-add-ability-to-record-that-a-user-has-gained-access-to-a-software-product-after-purchase-1' of https://github.com/jcreek/SvelteKitSaasBoilerplate into 14-add-ability-to-record-that-a-user-has-gained-access-to-a-software-product-after-purchase-1

This commit is contained in:
OllyNicholass
2024-07-05 15:12:37 +01:00
2 changed files with 5 additions and 9 deletions
+2 -5
View File
@@ -1,11 +1,8 @@
import { createClient } from '@supabase/supabase-js'; import { createClient } from '@supabase/supabase-js';
import stripe from 'stripe'; import stripe from 'stripe';
import type { Database, Tables, TablesInsert } from '$types/supabase'; import type { Database, Tables, TablesInsert } from '$types/supabase';
import { import { PUBLIC_SUPABASE_URL, PUBLIC_STRIPE_SECRET_KEY } from '$env/static/public';
PUBLIC_SUPABASE_URL, import { SUPABASE_SERVICE_ROLE_KEY } from '$env/static/private';
SUPABASE_SERVICE_ROLE_KEY,
PUBLIC_STRIPE_SECRET_KEY
} from '$env/static/public';
const toDateTime = (secs: number) => { const toDateTime = (secs: number) => {
const t = new Date(+0); // Unix epoch start. const t = new Date(+0); // Unix epoch start.
+3 -4
View File
@@ -82,10 +82,9 @@ export const POST: RequestHandler = async ({ request }) => {
} }
// Return a response to acknowledge receipt of the event // Return a response to acknowledge receipt of the event
return { return new Response(JSON.stringify({ received: true }), {
status: 200, status: 200
body: { received: true } });
};
} catch (err) { } catch (err) {
console.log(`Webhook Error: ${err.message}`); console.log(`Webhook Error: ${err.message}`);
return { return {