mirror of
https://github.com/jcreek/SvelteKitSaasBoilerplate.git
synced 2026-07-15 03:53:48 +00:00
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:
@@ -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.
|
||||||
|
|||||||
@@ -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 {
|
||||||
|
|||||||
Reference in New Issue
Block a user