Remove billing and checkout redirect buttons and related services
Deleted the billing-redirect-button, checkout-redirect-button, and embedded-stripe-checkout components. Additionally, removed the shadcn directory, which encompassed billing-related icons. This change streamlines the subscription settings interface and organizes the system's payment management. This update is a stepping stone towards improving the billing system's overall architecture.
This commit is contained in:
50
apps/web/app/api/billing/webhook/route.ts
Normal file
50
apps/web/app/api/billing/webhook/route.ts
Normal file
@@ -0,0 +1,50 @@
|
||||
import { getBillingEventHandlerService } from '@kit/billing-gateway';
|
||||
import { Logger } from '@kit/shared/logger';
|
||||
import { getSupabaseRouteHandlerClient } from '@kit/supabase/route-handler-client';
|
||||
|
||||
import billingConfig from '~/config/billing.config';
|
||||
|
||||
/**
|
||||
* @description Handle the webhooks from Stripe related to checkouts
|
||||
*/
|
||||
export async function POST(request: Request) {
|
||||
const client = getSupabaseRouteHandlerClient();
|
||||
|
||||
// we can infer the provider from the billing config or the request
|
||||
// for simplicity, we'll use the billing config for now
|
||||
// TODO: use dynamic provider from request?
|
||||
const provider = billingConfig.provider;
|
||||
|
||||
Logger.info(
|
||||
{
|
||||
name: 'billing',
|
||||
provider,
|
||||
},
|
||||
`Received billing webhook. Processing...`,
|
||||
);
|
||||
|
||||
const service = await getBillingEventHandlerService(client, provider);
|
||||
|
||||
try {
|
||||
await service.handleWebhookEvent(request);
|
||||
|
||||
Logger.info(
|
||||
{
|
||||
name: 'billing',
|
||||
},
|
||||
`Successfully processed billing webhook`,
|
||||
);
|
||||
|
||||
return new Response('OK', { status: 200 });
|
||||
} catch (e) {
|
||||
Logger.error(
|
||||
{
|
||||
name: 'billing',
|
||||
error: e,
|
||||
},
|
||||
`Failed to process billing webhook`,
|
||||
);
|
||||
|
||||
return new Response('Error', { status: 500 });
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user