mirror of
https://github.com/jcreek/SvelteKitSaasBoilerplate.git
synced 2026-07-13 11:03:49 +00:00
refactor(#29): centralise stripe client
This commit is contained in:
@@ -0,0 +1,4 @@
|
||||
import Stripe from 'stripe'
|
||||
import { STRIPE_SECRET_KEY } from '$env/static/private'
|
||||
|
||||
export const stripe = new Stripe(STRIPE_SECRET_KEY)
|
||||
@@ -1,8 +1,9 @@
|
||||
import { createClient } from '@supabase/supabase-js';
|
||||
import stripe from 'stripe';
|
||||
import type { Database, Tables, TablesInsert } from '$lib/types/supabase';
|
||||
import { PUBLIC_SUPABASE_URL, PUBLIC_STRIPE_SECRET_KEY } from '$env/static/public';
|
||||
import { PUBLIC_SUPABASE_URL } from '$env/static/public';
|
||||
import { SUPABASE_SERVICE_ROLE_KEY } from '$env/static/private';
|
||||
import { stripe as stripeClient } from '$lib/utils/stripe';
|
||||
|
||||
const toDateTime = (secs: number) => {
|
||||
const t = new Date(+0); // Unix epoch start.
|
||||
@@ -10,7 +11,6 @@ const toDateTime = (secs: number) => {
|
||||
return t;
|
||||
};
|
||||
|
||||
const stripeClient = new stripe(PUBLIC_STRIPE_SECRET_KEY);
|
||||
|
||||
type Product = Tables<'products'>;
|
||||
type Price = Tables<'prices'>;
|
||||
|
||||
Reference in New Issue
Block a user