File tree Expand file tree Collapse file tree 1 file changed +12
-0
lines changed
Expand file tree Collapse file tree 1 file changed +12
-0
lines changed Original file line number Diff line number Diff line change @@ -2,6 +2,10 @@ import { NextRequest, NextResponse } from "next/server";
22import Stripe from "stripe" ;
33import { Client , Databases } from "node-appwrite" ;
44
5+ // Force dynamic rendering for webhook endpoint
6+ export const dynamic = "force-dynamic" ;
7+ export const runtime = "nodejs" ;
8+
59// Map Stripe price IDs to subscription types
610const PRICE_ID_TO_SUBSCRIPTION : Record < string , string > = {
711 [ process . env . NEXT_PUBLIC_STRIPE_PRICE_ADS_FREE || "" ] : "ads-free" ,
@@ -20,6 +24,14 @@ function getAppwriteClient() {
2024 return new Databases ( client ) ;
2125}
2226
27+ // GET handler for testing/health check
28+ export async function GET ( ) {
29+ return NextResponse . json ( {
30+ message : "Stripe webhook endpoint is active" ,
31+ timestamp : new Date ( ) . toISOString ( ) ,
32+ } ) ;
33+ }
34+
2335export async function POST ( request : NextRequest ) {
2436 const body = await request . text ( ) ;
2537 const signature = request . headers . get ( "stripe-signature" ) ;
You can’t perform that action at this time.
0 commit comments